.JAR woes. It just refuses to work for me :-(

I spent a week building a simple java app from a C program I wrote a couple of years ago. The process has not been without tears, but I've enjoyed it. That is, up until the point of trying to make it into an 'executable' jar file. No matter what I do, it would refuse to launch and give 'can't find blah..' errors. After a couple of days of this and getting nowhere, it's starting to hack me off seriously.
To wipe out any oddness with my immature Java code, I dropped back to a 'hello world' basic program and tried again - but I still cannot get a working .jar out of it...
PLATFORM: Debian Linux
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
This is what I've done - can anyone spot the error?
Directory /develop/java/package1
contains:
HelloWorld.java
HelloWorld.java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
}This compiles to HelloWorld.class and it runs without any issue with:
java HelloWorld
from inside the /develop/java/package1
{funny enough from anywhere else in the filesystem it *wont* run - eg: java /develop/java/package1/HelloWorld - I'm not sure if that is relevant or standard Java security}
I have a manifest creation file in the parent directory (/develop/java/) that looks like this:
Main-Class: HelloWorld.classTo give it an Entry Point.
I try to create a simple executable .jar by running the command:
jar vcmf manifest HelloWorld.jar package1From the: /develop/java/ directory. This runs without error and creates HelloWorld.jar
jar vcmf manifest HelloWorld.jar package1
added manifest
adding: package1/(in = 0) (out= 0)(stored 0%)
adding: package1/HelloWorld.java(in = 124) (out= 101)(deflated 18%)
adding: package1/HelloWorld.class(in = 427) (out= 289)(deflated 32%)
Checking the /META-INF/MANIFEST.MF shows:
Manifest-Version: 1.0
Created-By: 1.6.0_14 (Sun Microsystems Inc.)
Main-Class: HelloWorld.classBut trying to execute it with: java -jar HelloWorld.jar throws:
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class
Caused by: java.lang.ClassNotFoundException: HelloWorld.class
     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: HelloWorld.class. Program will exit.
I've tried altering paths, where I create the jar from etc, but it persists and after days of looking at this, I'm starting to wish I never bothered. What the hell am I missing here? It has to be staring me in the face?

mike120 wrote:
package1 is the directory - not a package name (that is, part of the path) - sorry for any confusion.It does not matter. The directory in the Jar, and the package name, must be identical. So do it one way or the other.
1) package1 package.
Source:
package package1;
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
Jar content:
jar tvf HelloWorld.jar
0 Tue Dec 01 09:16:58 GMT 2009 META-INF/
95 Tue Dec 01 09:16:58 GMT 2009 META-INF/MANIFEST.MF
0 Tue Dec 01 08:24:14 GMT 2009 package1/
124 Tue Dec 01 08:24:12 GMT 2009 package1/HelloWorld.java
427 Tue Dec 01 08:24:14 GMT 2009 package1/HelloWorld.class
Manifest:
Main-Class: package1.HelloWorld2) No package.
Source:
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
Jar content:
jar tvf HelloWorld.jar
0 Tue Dec 01 09:16:58 GMT 2009 META-INF/
95 Tue Dec 01 09:16:58 GMT 2009 META-INF/MANIFEST.MF
124 Tue Dec 01 08:24:12 GMT 2009 HelloWorld.java
427 Tue Dec 01 08:24:14 GMT 2009 HelloWorld.class
Manifest:
Main-Class: HelloWorld

Similar Messages

  • Microsoft Word 2008 refuses to work for me after installing the most recent Mavericks update, 10.9.1. It is 2008, yet Excel and Powerpoint work just fine. Help!

    Microsoft Word 2008 refuses to work for me after installing the most recent Mavericks update, 10.9.1. It is 2008, yet Excel and Powerpoint work just fine. Help!

    I suggest you do one of two things:
    1. Upgrade to Office 2011 for OS X.
    2. Try the freeware, Libre Office.

  • I still am having problems with Aperture not loading,  It just refuses to work, and I get the message saying it has encountered a problem, and I may need to re-install which I have done dozens of times. The fix mentioned on an earlier post wont work as it

    I still am having problems with Aperture not loading,  It just refuses to work, and I get the message saying it has encountered a problem, and I may need to re-install which I have done dozens of times. The fix mentioned on an earlier post doesn't work as it is for Ver 10.6.6 and I am running 10.6.7

    Do you have Final Cut installed on your machine?
    If so, you may want to look at this article: http://support.apple.com/kb/TS3528
    Let us know if that helps.

  • Adobe update refuses to work for CS6 and Photoshop elements. App manager refuses to install.

    Adobe update refuses to work for CS6 and Photoshop elements. App manager refuses to install. Support Advisor is of no help.Anyone had the same problem? It has all worked perfectly for some years now, but refuses this week.Has Adobe changed something.Windows 7.

    Re: Adobe update refuses to work for CS6 and Photoshop elements. App manager refuses to install.
    created by Pat Willener in Downloading, Installing, Setting Up - View the full discussion
    What exactly means "refuses"?
    This is the message which comes up if I try to update (from the Help menu) or re-install my licenced copies of CS6 or Photoshop Elements 9.
    “We've encountered the following issues
    Installer failed to initialize.Please download Adobe Support Advisor to detect the problem”
    Get Adobe Support Advisor”
    OR
    on trying to open PhotoshopCS6 I get this message:-
    “Adobe Application Manager required to start your trial, is missing or damaged.
    Please download a new copy of Adobe Application Manager from http://www.adobe.com/go/applicationmanager_uk”
    When I follow these instructions and try and start up/install or update Photoshop CS6 I get the same messages all over again. This has been going on since Tuesday afternoon and I am anxiuous to resolve the problem. For several years now all this has worked perfectly through your website and I cannot understand what has changed.  Once I cancel these messages the products themselves seem to function OK. When I attempt to use Adobe Update Manager I get the same messages as above. You will see that my products are properly licensed and up to date. Have you any solution?

  • Isn't your apple PW, which I just changed and worked for several other functions, Isn't this the correct PW to use when installing updated adobe flash player?

    I am having trouble installing new adobe flash player, they ask for my pw, isnt this the same PW I use for APPLE? the new pw i just created works for other functions! thanks. Miss Curity

    Welcome to Apple Support Communities
    When you install an application, you have to type your user password, which is different than your Apple ID password. You set your user password when you got your computer.
    If you do not remember the user password, follow these steps to reset the user password > http://discussions.apple.com/docs/DOC-4101 You will have to reset your Keychain > http://support.apple.com/kb/ht1631

  • I need help finding a workable web program that is not CSS based.  I tried IWeb and it just won't work for me.  Way too limiting.  I've been using a 12 year old copy of Macromedia Dreamweaver, but the new Dreamweaver is CSS

    Been building web pages for nearly 20 years, starting with GoLive.  Went to Dreamweaver about 12 years ago, the Macromedia version.  Tried going to iWeb when it came with a new Mac, but found it way too limiting with it's CSS template base.   Unknowlingly, I then bought a new copy of Dreamweaver.   Ooops, Adobe had bought Macromedia and Dreamweaver, too, is now CSS based, which for my money makes it useless to anyone who likes simplicity.   Now I find that even iWeb has been discontinued.  I was told yesterday that Apple doesn't have a web program any more.   At 12 years old, I just don't think it's practical to try to load my old Macromedia Dreamweaver into the new Mountain Lion (I'm getting a new Mac), though it is running, barely, in Snow Leopard.
    I need to find a web builder program that will permit simple construction of educational pages, nothing fancy, nothing artistic, just create a page, give it a color, type or drag in text, insert a table, insert pix in the table blocks, add text under the pix... done!    I should note that I am not looking to build traffic.  I teach simple things for free and people who want to learn those things (antique sewing machine repair, quilting, building longbows) find me.
    I've downloaded trial versions of half a dozen or so programs and looked at maybe 20 more, but all are either CSS based and drive me insane with requirments for constantly making rules and template models, and/or require that you base your web presence in their server.   Also, many will not work with pages built in other programs.  I maintian a volume of over 1000 web pages, many requiring regular updating, and they have been with the same server for more than 15 years.  I'm not about to change.
    So, anybody know a simple, old fashioned web builder that's happpy on a Mac platform?
    Captain Dick

    Although not supported anymore, iWeb does still function using Mountain Lion...
    http://www.iwebformusicians.com/iWeb/mountain-lion.html
    ... and you can purchase it from Amazon.
    Start with a blank page using the Black or WHite template.
    All modern websites use CSS and there are thousands of free templates to be had if you want to use a code entry style application. You will need to go this route if you want to create a site that is viewable on mobile devices although you can create an iPhone version using iWeb...
    http://www.iwebformusicians.com/iWeb/Mobile-iWeb.html
    Search this forum for numerous topics about iWeb alternatives.

  • Links in open tabs just flat stop working for a while with FF4.0

    Installed FF4.0 a few days ago - consistent problem (but do not know how to reproduce it on demand):
    I routinely have 8-10 tabs open on various forums and web sites I check regularly, but often I do not visit some of them for a day or more. Almost always now when I go to one of those tabs that I have not used for a while, none of the links work on it. Refreshing the tab does nothing, no links work. But the tabs I have been using recently still work fine, and new tab open and work OK. I have NEVER seen this problem before with any of the various FF3 versions.
    If I play with it long enough by trying various links, refresh, opening new tabs, and whatever else comes to mind, it seems to finally wake up after about 15 minutes or so. This problem has happened to me at least once a day, every day, for the past week or so since I upgraded to 4.0. When it happens, it is not just one tab - it is ALL of the open tabs that I have not used in a while, but any that I have been regularly checking that day continue working fine. Very irritating.

    You can try to disable hardware acceleration in Firefox (you need to close and restart Firefox).
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    You can boot the computer in Windows Safe Mode with network support (press F8 on the boot screen) as a test to see if that helps.

  • Substitution Variables just don't work for me

    I have a database that I want to copy data from one version of existing data to another version using substitution variables.<BR><BR>I have a version of (target) data named "Flash Sep Test" that I want to copy to, and a version (source) "HQ1" with the data I want to copy from <BR><BR>My substitution variable at (same) database level is called "Flash1" with value of "Sep"<BR><BR>My calc script code is:<BR><BR>DATACOPY "HQ1" TO "Flash &Flash1 Test";<BR><BR>When I run the calc I get this error:<BR><BR>Invalid Member name "Flash &Flash1 Test" and it won't copy the data over.<BR><BR>Any suggestions on how to get this to work will be much appreciated...HELP!!!???<BR><BR><BR>Sign me,<BR>A very frustrated db admin<b>Text</b>

    Andy and Will,<BR><BR>Thanks for your help!<BR><BR>I figured out to use the variable value with the quotes like this <BR><BR> <b>"Flash Sep Test"</b> <BR><BR>did work when I just placed the variable name <BR><BR> <b>&varFlash</b> <BR><BR>in the calc code without quote marks. Sure wish Essbase's help function explained the use of this (and other code) better than it does. Hope it has improved by ver 7.#.<BR><BR>Thanks again for your assistance!<BR><BR>Alan Hartt<BR>Hewlett Packard

  • Can I punish mybratty kid by suspending his phone use for say one or two days and then turn it back on how hard is it to turn it back on or will it end up just being more work for me

    So my kids got it all figured out but I pay for the phone so I thought I would turn it off for a few days and see if his attitude changed when I go to suspend service it makes me think how hard it might be to reactivate service so what are your thoughts on that and if you have any ideas to help

    I am not sure if this will work, but you could look in Family Base.  With this source you can control who they call, text, and what website they go to. It is just $5 per month.  That may control their usage.  Try calling Customer Service (*611) about it.
    I hope it helps! Good Luck!
    Here are some links about it:
    FamilyBase FAQs | Verizon Wireless
    How to Use Guide: Verizon FamilyBase | Verizon Wireless

  • Ovi 2.0.1.35 just doesn't work for Music!

    After finally working out that having a MicroSD card in my N97 was causing all my music player problems on the device I have had a happy 24 hours of being able to play music back when I wanted to (and control the volume).
    Today I went to add some more track with the Nokia Music PC app... It told me there was an upgrade... Oh I think, so I told it to upgrade.
    Imagine my reaction when my old, very useful and working Nokia Music PC app was replaced with Ovi 2.0.1.35, which says it cannot find any music on my PC (even when I told it where all the tracks are) and cannot find any of the music on my N97.
    The old Nokia Music app worked, was very useful for ID3 editing, and now appears to have been replaced by some Apple-esq pretty piece of cr*p... Maybe it is just as powerful but as I can't get it to recognise a single MP3 on my PC or phone I can't tell!
    Does anyone know where I can get the old Windows Nokia Music PC application from so I can re-install it?
    Message Edited by tankslappa on 12-Nov-2009 12:50 PM

    Hi tankslappa,
    Could you tell me when exactly you got a message to Install the Upgrade to Nokia Ovi Suite 2.0. ( I mean, while using Nokia Music or while using the application. I have Nokia Music installed, but the option to upgrade does not come up.
    You can get Ovi Player ( which is as same as Nokia Music) from the link provided below
    http://musicstore.nokia.com/download.aspx
    Cheers
    Sandy
    Helpful information, then dont forget to hit the kudos star :-) Or say it accepted solution and thanks

  • I have tried everything to get my iphone5 to pair sucessfully with my new i40 satnav system and it just refuses to work., I have tried everything to get my iphone5 to pair sucessfully with my new i40 satnav system and it just refuses to work.

    I have just bought a Hyundai i40 sedan and can not get my i phone 5 to work.  I have been able to pair it but am unable to make or receive a call.
    I did insert a CD and it was playing and briefly I might add very briefly I was able to hear an indistinct voice.  also the blue tooth music stick wont work in the U.S.B. port and did in the previous car.

    I just bought an Altima SV about 3 hours ago and I am pretty angry to discover while driving it home that the iPhone 5 will not connect to it via bluetooth.

  • It has been 6 days and iTunes Match just does not work for me!

    It starts but never finishes step 3 and starts all over again. I do not know what to do.

    Hi Jojo,
                   could you please kindly try this UDF, no need to add any variable var1 as input, just map this to the target root as you were doing previously.
    public String getFileName(Container container){
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String ourSourceFileName = conf.get(key);
    ourSourceFileName=ourSourceFileName.replaceAll(".txt",".xml");
    conf.put(key, ourSourceFileName);
    return ourSourceFileName;
    In your code you have one line  as shown below
    filename = filename.replaceAll( ".txt" ,"_" );
    I am not sure why you added this in your code,maybe you wanted an underscore to be added to your target filename.
    In that case just modify one line of the code I wrote above
    this line  
    ourSourceFileName=ourSourceFileName.replaceAll(".txt",".xml");   is to  be replaced by this
    ourSourceFileName=ourSourceFileName.replaceAll(".txt","_.xml");
    Ensure the following events
    1. Sender CC has ASMA and file name ticked
    2. Receiver CC has ASMA and file name ticked
    3.  "fail if ASMA missing" untick this. If this UDF runs successfully then later you can tick this and save the changes.
    3. UDF has no input as variable, since you are not using the var1 variable anywhere in your code.
    4. in receiver communication channel -> File access parameters-> File name scheme -
    > put  a default filename with XML extension such as default.xml.
    Hope this helps.
    regards
    Anupam

  • Smart folders just refuse to work

    hi i cannot get anything to show in smart folders/web gallerys, i have tried a simple star rating, and keywords, both cases knowing there are not too many of either so its not a problem dues to 1000s of pics.

    As you are probably aware, smart folders are "aware" of the library structure...if you're attempting to build one in a library folder where there are NONE of the target images, you'll get this result. If you set the smart folder at the main Library level, then it will "operate" on the entire Library and find any that are there. So, be sure you've made the proper selection in the folders pane....
    hope this helps.

  • Help... Itunes wont work for 2nd time now, and very important....

    This is the 2nd time, itunes just totally stopped working for me ( Like wont open, no matter if I click on it in the quick launch, The shortcut, or the actual program...
    This time is not like the last time however...
    Song's that I have recorded here at my home studio that I have yet to burn are on there... And Beat's that I have made, that are not backed up in FL Studio are in there, and so are numerous Mixtapes I have made, but yet to burn on to disc's.
    I don't want to lose all those song's!!!
    As a matter of fact I have 800+ Song's on my itunes, and I don't want to lose them!
    Please help me out, I was just gonna burn all my stuff just today.

    Try this :
    http://discussions.apple.com/thread.jspa?threadID=315147&tstart=30

  • *imessage not working for few contacts

    Hello,
    I have an iPhone 4 and about a few days ago, my imessages refuses to work for only a few of my contacts. For example, I tried to send an imessage to my sister the other day (who also has an iPhone 4 with imessage activated & on), but the "send" button is green and will only allow me to send as text messages. This was the same for my sister who tried to send me an imessage; she can only send it through text to me.
    I tried turning the imessage system on and off and even re-activated it for both my sister and me, but it still didn't solve the problem.
    My mom who has a mini-iPad is also having this problem with me. She nor I cannot send messages through imessage either...
    This is really frustrating because this was sort of the main communication source between her and me since I am away at school.
    If anyone can please help us out or even give us a few helpful pointers, I will be more than greatly appreciated.
    Thank you again and you can also e-mail me at [email protected] for quicker communication.
    Thank you!
    Jenny

    Hi everyone,
    I solved my problem by using "razmee209"'s help as well as reseting network settings.
    Thank you!

Maybe you are looking for