Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No Display when running the jar

 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi fellow ranchers

I created my runme.jar for some final testing and have hit a snag as the error messages and my log messages are not being displayed when I run this. My log file is set up as follows:




Everything works fine in Eclipse.

So for example running "runme.jar a" in Dos just exits the application with no messages.

If I run this in Eclipse I get:



Has anyone else encountered this problem. I am using java 1.6.0_12

Thanks Kevin
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kevin, I don't personally use Eclipse but Netbeans, but the idea is the same. Does Eclipse use any internal classpath you are not aware of? How does Eclipse build the application?

If you don't use Eclipse to build the app, but use command prompt, do you get the same result when running the app?
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The build that I use in Eclipe works fine.

My manual build is the problem.

I created the classes in Dos using javac then created the jar in Dos as well.

My path points to the 1.6.0_12 jdk and I have used a version checker to make sure I am getting a 1.6 compile.

Everything else works fine in my manual build, just not displaying log info meassages and System.err.println() in the Dos window.
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you include a manifest file when "manually" creating your runme.jar specifying the main class and remember the extra line at the end?

If you use Windows OS you may want to use batch files to compile and create the jar.

My file structure looks like this in the root:
docs dir - documentation files go here
code dir - source files go here
classes dir - compiled class files go here
version.txt
database file
runme.jar
manifest.txt
whole bunch of batch file xxx.bat

Then my build.bat file looks like this
javac -d classes code/<full-package-name>/*.java
jar cvfm runme.jar manifest.txt -C classes .

Then my run file looks like this where "alone" is the mode flag:
java -jar runme.jar alone


If all goes wrong, check your app entry point main method.
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ken

I have no problem compiling the classes and the jar file works fine (yes I have a Manifest.mf file for this).

I do the following from the code subdirectory:

then after I move up to my main directory I do:


My problem isnt getting a working jar its the fact that I am not getting system messages and log messages in Dos window. Everything else I test seems to work (gui display, booking etc) its just these missing log messages and system error messages that have me stuck at the moment.

Cheers Kevin.

 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

is it be possible that you are using "javaw.exe" to launch your jar (rather than java.exe) ? How do you launch your jar ? Manually with the "java -jar.." command or do you double click on it ?
You could check to which executable .jar extention is linked on your OS.

bye,
Alex
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex.

Thanks for that post, I had become blinkered there and was just running runme.jar

Now doing java -jar runme.jar a

And all messages are appearing as they should
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic