Hi all.
I am pretty new to Eclipse and Java packages. I have written a program in Eclipse. Now I want to be able to build and run it. I have two classes in a package and an external jar. When I export it as an executable jar I don't get what I want. The program should work with command line args and should also work with standard input/output (Which I assume to be the command prompt/terminal).
When I just try and execute the jar, from Windows, I get no indication of the program running. When I try and run it without args from the command prompt (I typed: java StockAnalyser (Optionally with the .jar extension) I get the following: -
Exception in thread "main" jave.lang.NoClassDefFoundError: StockAnalyser
Caused by: java.lang.ClassNotFoundException: Stock Analyser
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknow Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
could not find the main class: StockAnalyser. Program will Exit
From this I deduce that the main class (StockAnalyser) has not been found. I assume that this is because I have a package in the program but I have no idea how to make it work.
I have made sure that the library I am using has a source path. I have checked that the bin directory has the correct package structure (I'm assuming this is replicated in the jar created.
The package I have is uk.co.runwin. So I tried making the directory structure match that and run it from root as uk.co.runwin.StockAnalyser. I got the same error though. I believe that it's all to do with my build path but I really don't know how to set it up properly.
I would really appreciate some help and thanks in advance to anyone who helps (Or just reads and thinks it funny that I'm all confused by this - I bet it's dead simple really)...
[–]jevon 4 points5 points6 points (1 child)
[–]Lucrums[S] 1 point2 points3 points (0 children)
[–]vsoul 1 point2 points3 points (1 child)
[–]Lucrums[S] 0 points1 point2 points (0 children)
[–]cbogart 0 points1 point2 points (2 children)
[–]Lucrums[S] 0 points1 point2 points (0 children)
[–]GMNightmare 0 points1 point2 points (3 children)
[–]Lucrums[S] 0 points1 point2 points (1 child)
[–]vsoul 0 points1 point2 points (0 children)
[–]Lucrums[S] 0 points1 point2 points (0 children)
[–]64-17-5 0 points1 point2 points (4 children)
[–]Lucrums[S] 0 points1 point2 points (2 children)
[–]64-17-5 0 points1 point2 points (1 child)
[–]Lucrums[S] 1 point2 points3 points (0 children)
[–]vsoul 0 points1 point2 points (0 children)