0

I created locally a small multithreaded parsing application just to get acquainted with multithreading and jsoup parser library.

On the server I installed java as it was described in this question/answer "How to install the Sun Java JDK on Ubuntu 10.10 (Maverick Meerkat)?".

Here are my source files:

It was really easy to launch this application via IDE, but how to do it via terminal with *.jar library I don't know.

Thanks to everyone who can help.

Community
  • 1
  • 1
Eugene
  • 4,352
  • 8
  • 55
  • 79

2 Answers2

1

Did you package your application as an executable jar file using your IDE? If so, then running it in a terminal might be as simple as:

java -jar MyProgram.jar

or even just double-clicking the jar file.

To learn how to package your program as an executable jar file, see this tutorial: Packaging Programs in JAR Files.

The manifest file in the jar file should contain an attribute that looks like this:

Main-Class: test.parsing.ParseArtCoderExample
Jesper
  • 202,709
  • 46
  • 318
  • 350
  • And if I would like to launch my files without *.jar usage, then this will be much more difficult I guess? – Eugene Jul 14 '11 at 14:37
  • Works perfectlly and easy. IntelliJ is great. – Eugene Jul 14 '11 at 14:46
  • If it isn't in a jar, it's also not very hard: something like `java -cp . test.parsing.ParseArtCoderExample`, when you're in the base directory of the package. – Jesper Jul 14 '11 at 18:30
  • Great. Thank you. Could I ask here in comments about database usage or it is better to do as separate question if I will not find an answer. Asking it since the question will regard same parsing application. I need to put parsed results into database. – Eugene Jul 14 '11 at 22:21
  • Better ask it as a separate question; StackOverflow doesn't work well for conversations in comments. – Jesper Jul 15 '11 at 06:47
  • Posted here http://stackoverflow.com/questions/6705874/trying-to-connect-to-mysql-database-with-jdbc. – Eugene Jul 15 '11 at 11:45
0

Get your IDE to export a jar file (not sure what IDE you are using) that has the Main-Class manifest set correctly and you should be good to just run java -jar {jarfilename}. Which IDE are you using?

Femi
  • 64,273
  • 8
  • 118
  • 148