String exampleClassDirectory = Example.class.getResource("Example.class").getPath();
Also, it appears you're using a static variable called class to call getResource()
Type: Posts; User: javapenguin
String exampleClassDirectory = Example.class.getResource("Example.class").getPath();
Also, it appears you're using a static variable called class to call getResource()
That's the problem. How will it know where the directory is if the jar is installed or put anywhere on other computers?
Also, why are you returning the path of the parent file? Why not the jar...
Hmmmm...well,
File aFile = new File();
String absolutePathName = aFile.getAbsolutePath();
String pathName = aFile.getPath();
Also, maybe I'm wrong, but don't you need the full path...
Wait, is the code supposed to make it a jar file for you? If not, just go to export and Runnable Jar File. If that won't work, try export and Jar File.
Put the Jar file in the same area as your code
You can find it under "Properties" if you're using Eclipse:
Path: /wenguin/src/McWoo/Testing.java
Type: File (Java Source File)...