Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 19 of 19

Thread: jar file Built(clean and build) perfectly, but not running as jar

  1. #1
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default jar file Built(clean and build) perfectly, but not running as jar

    i was able to build some different projects and run those .jar files perfectly, those projects have a simple frame (main program) that when a jar file is executed, frame will appear, but when i build my own application the game that i was writing, it was built(build) perfectly, but when i try to run its jar file from dist(directory), notting happens, im using latest version of netbeans IDE standard bundle, latest java Dev kit, i read some tutorials, i set the main class perfectly, i run the project inside the IDE itself, it works fine, i tried different types of projects , application, desktop application, project with existing sources, still my game's jar file doesnt run, only those projects with simple JFrame object(main method) runs

    my game is using sql 5.1, the project has inlcluded some necessary libraries such as jdbc driver, Java media framework,
    i dont know what part should i ask other than, "why is it my jar file is not running"

    i also tried to include a simple main program that has a simple JFrame object(FRAMESAMPLE.class) inside the same package where all the classes of my game are, and set that class(FRAMESAMPLE.class) as the main class of the project when it is built, i went to dist folder, run the jar file, and it works fine, the class that has a simple frame object appears.

    my game classes uses external files such as audio files, images files, that is stored on the same package, and i call those images and audio by using class loader,

    when i set the FRAMESAMPLE.class as the main class of the project again, it works fine, this class doesnt have anything other than a JFrame object
    Last edited by chronoz13; July 11th, 2011 at 04:20 AM.


  2. #2
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    woot O_O'

    by the way i noticed this thing
    public class FRAMESAMPLE {
     
        public FRAMESAMPLE() {
     
            setWindowComponents();
        }
     
        private class Panel extends JPanel {
     
            public Panel() {
     
                setLayout(null);
                setBackground(Color.BLACK);
            }
     
            public void paint(Graphics g) {
     
                super.paint(g);
                g.drawImage(createImageIcon("KKKFOLDER\\smallFlag.png").getImage(), 100, 100, this);
                repaint();
            }
        }
     
        public void setWindowComponents() {
     
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(new Panel());
            f.setSize(500, 700);
            f.setVisible(true);
        }
     
        public static void main(String[] args) {
     
            new FRAMESAMPLE();
        }
     
     
        /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path) {
     
            java.net.URL imgURL = FRAMESAMPLE.class.getResource(path);
     
            if (imgURL != null) {
     
                return new ImageIcon(imgURL);
            }
            else {
     
                System.err.println("Couldn't find file: " + path);
                return null;
            }
        }
    }

    when the image is not drawn, and when i try to run the .jar file, it runs fine, with a frame object shown and a black background, but when i draw an image and i run the .jar file, i only see a JFrame with a white background, and nothing else, but everything is working fine inside the IDE

  3. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    as of now , my assumption is this, i went back to my game's main class, i tried to remove all the components inside of it, and leave only the JFrame itself, inside the IDE it runs perfectly, the frame is being visible but without anything ofcourse, now i cleaned and built the project again, set this class as the main class for the project, and i go to dist folder, run the jar, and it runs perfectly, a visible frame without anything on it,
    i notice that when this method is being used

    /** Returns an ImageIcon, or null if the path was invalid. */
        protected static ImageIcon createImageIcon(String path) {
     
            java.net.URL imgURL = OpeningWindow.class.getResource(path);
     
            if (imgURL != null) {
     
                return new ImageIcon(imgURL);
            }
            else {
     
                System.err.println("Couldn't find file: " + path);
                return null;
            }
        }

    for example Image anImage = createImageIcon("imagepath").getImage(), when this statement is included the jar file is not running, but when i removed this statement, the jar runs fine, is the problem occurs in the class loader? omg if it is, this will be a big problem

  4. #4
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    i dont know where to view the exception if there is something happening like ClassNotFoundException , or some class loader error, all i feel right now is the class loader that loads an external file such as an image gives a problem with my jar file


    am i experiencing a JAR hell?
    Last edited by chronoz13; July 11th, 2011 at 04:58 AM.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    when i try to run its jar file from dist(directory), notting happens
    Are you on a Windows OS?
    Open a command prompt window, change to the directory with the jar file and enter this:

    java -jar <YOURJARFILENAMEHERE>.jar

    Copy and paste the full contents of the console window here:
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  6. #6
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    yes norm im using Windows 7, heres what ive got

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
     
    C:\Users\Zabdiel> cd\
     
    C:\>cd\users
     
    C:\Users>cd\users\zabdiel
     
    C:\Users\Zabdiel>cd\users\zabdiel\My Documents
     
    C:\Users\Zabdiel\My Documents>dir
     Volume in drive C has no label.
     Volume Serial Number is 7C80-F20B
     
     Directory of C:\Users\Zabdiel\My Documents
     
    File Not Found
     
    C:\Users\Zabdiel\My Documents>cd\users\zabdiel\My Documents\Netbeans Projects
    The system cannot find the path specified.
     
    C:\Users\Zabdiel\My Documents>cd\users\zabdiel\My Documents\NetbeansProjects
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects>dir
     Volume in drive C has no label.
     Volume Serial Number is 7C80-F20B
     
     Directory of C:\Users\Zabdiel\My Documents\NetbeansProjects
     
    07/11/2011  06:06 PM    <DIR>          .
    07/11/2011  06:06 PM    <DIR>          ..
    07/11/2011  06:06 PM    <DIR>          JavaApplication3
    07/11/2011  06:07 PM    <DIR>          JavaLessonsAndSamples
    07/11/2011  11:00 PM    <DIR>          KKK
                   0 File(s)              0 bytes
                   5 Dir(s)  424,347,590,656 bytes free
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects>cd\users\zabdiel\My Documents\Net
    beansProjects\KKK
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK>dir
     Volume in drive C has no label.
     Volume Serial Number is 7C80-F20B
     
     Directory of C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK
     
    07/11/2011  11:00 PM    <DIR>          .
    07/11/2011  11:00 PM    <DIR>          ..
    07/11/2011  11:00 PM    <DIR>          build
    06/30/2011  07:33 AM             3,704 build.xml
    07/11/2011  05:28 PM    <DIR>          dist
    06/30/2011  07:33 AM                85 manifest.mf
    07/11/2011  11:00 PM    <DIR>          nbproject
    07/11/2011  10:32 PM    <DIR>          src
                   2 File(s)          3,789 bytes
                   6 Dir(s)  424,347,066,368 bytes free
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK>cd\users\zabdiel\My Documents
    \NetbeansProjects\KKK\dist
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>dir
     Volume in drive C has no label.
     Volume Serial Number is 7C80-F20B
     
     Directory of C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist
     
    07/11/2011  05:28 PM    <DIR>          .
    07/11/2011  05:28 PM    <DIR>          ..
    07/11/2011  11:00 PM        23,084,380 KKK.jar
    07/11/2011  11:00 PM    <DIR>          lib
    07/11/2011  11:00 PM             1,319 README.TXT
                   2 File(s)     23,085,699 bytes
                   3 Dir(s)  424,347,090,944 bytes free
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>-jar KKK.jar
    '-jar' is not recognized as an internal or external command,
    operable program or batch file.
     
    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    Where did you enter the java command as I described in post #5? I don't see it in your post.

    java -jar asdf.jar

  8. #8
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    ill add some more, ill try to make this as understandable as i can, ok now..
    after searching and asking google, i ended up with something usefull the backslah "\\" for calling external files, such as images, some articles said, the class loader doesnt recognize this character so instead change it to a single forward slash "/" , i change all the double backslash in my classes into a single forward slash, i did the same procedure , clean and build, still the .jar doesnt run,

    now with so much code to look at, i went back to the FRAMESAMPLE.class on my first statements i said
    when the image is not drawn, and when i try to run the .jar file, it runs fine, with a frame object shown and a black background, but when i draw an image and i run the .jar file, i only see a JFrame with a white background, and nothing else, but everything is working fine inside the IDE
    now i used all the resources i got, using a single forward slash "/" and boom this FRAMESAMPLE.class works fine, with an image, and with a sound from loading from a class loader, i went back again to the main class of my game with the modified slashes, and jar hell , still not working

    note: everything im doing is inside the same project-package

  9. #9
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    Where did you enter the java command as I described in post #5? I don't see it in your post.
    inside the folder where the .jar file is, the dist directory

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    You need the error message from the java command to be able to determine what is wrong.
    See post #5

  11. #11
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    ok ok hang on, ill try to run it properly in a command line, im just not use to run java commands on a cmd prompt

  12. #12
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    oh there i went inside the java/bin and run the command java -jar <file>.jar
    'di' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist

    07/11/2011 05:28 PM <DIR> .
    07/11/2011 05:28 PM <DIR> ..
    07/11/2011 11:00 PM 23,084,380 KKK.jar
    07/11/2011 11:00 PM <DIR> lib
    07/11/2011 11:00 PM 1,319 README.TXT
    2 File(s) 23,085,699 bytes
    3 Dir(s) 424,344,768,512 bytes free

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist> java -jar KKK
    'java' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>java -jar KKK.jar
    'java' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist> cd\

    C:\>cd\program files

    C:\Program Files>dor
    'dor' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Program Files

    06/29/2011 01:29 AM <DIR> .
    06/29/2011 01:29 AM <DIR> ..
    06/25/2011 10:38 AM <DIR> 7-Zip
    06/25/2011 10:58 AM <DIR> Adobe
    06/23/2011 07:03 PM <DIR> ASUS
    06/25/2011 10:56 AM <DIR> Common Files
    07/14/2009 12:47 AM <DIR> DVD Maker
    06/23/2011 06:54 PM <DIR> Elantech
    06/24/2011 09:03 AM <DIR> Internet Explorer
    07/14/2009 12:46 AM <DIR> Microsoft Games
    06/25/2011 10:33 PM <DIR> Microsoft Office
    07/13/2009 10:32 PM <DIR> MSBuild
    06/29/2011 01:29 AM <DIR> MySQL
    06/23/2011 06:46 PM <DIR> NVIDIA Corporation
    06/23/2011 07:01 PM <DIR> P4G
    06/23/2011 06:51 PM <DIR> Realtek
    07/13/2009 10:32 PM <DIR> Reference Assemblies
    07/13/2009 10:37 PM <DIR> Windows Defender
    07/14/2009 12:46 AM <DIR> Windows Journal
    06/24/2011 09:03 AM <DIR> Windows Mail
    06/24/2011 09:03 AM <DIR> Windows Media Player
    07/13/2009 10:32 PM <DIR> Windows NT
    07/13/2009 10:37 PM <DIR> Windows Photo Viewer
    07/13/2009 10:32 PM <DIR> Windows Portable Devices
    07/13/2009 10:37 PM <DIR> Windows Sidebar
    0 File(s) 0 bytes
    25 Dir(s) 424,345,473,024 bytes free

    C:\Program Files>cd\

    C:\>cd programFiles(x86)
    The system cannot find the path specified.

    C:\>cd program files(x86)
    The system cannot find the path specified.

    C:\>cd\program files(x86)
    The system cannot find the path specified.

    C:\>cd\program files

    C:\Program Files>cd]
    The system cannot find the path specified.

    C:\Program Files>cd\

    C:\>cd\program filesx86
    The system cannot find the path specified.

    C:\>cd\program files(86)
    The system cannot find the path specified.

    C:\>java -jar KKK.jar
    'java' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>\java -jar KKK.jar
    '\java' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>cd\program files *86
    The filename, directory name, or volume label syntax is incorrect.

    C:\>cd\program files(*86)
    The filename, directory name, or volume label syntax is incorrect.

    C:\>cd\program files*86*

    C:\Program Files (x86)>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Program Files (x86)

    07/10/2011 09:08 PM <DIR> .
    07/10/2011 09:08 PM <DIR> ..
    06/25/2011 10:57 AM <DIR> Adobe
    06/25/2011 10:55 AM <DIR> Adobe Media Player
    06/24/2011 07:05 AM <DIR> ASUS
    06/23/2011 06:59 PM <DIR> Atheros
    06/24/2011 11:44 PM <DIR> BabylonToolbar
    07/07/2011 01:15 AM <DIR> bfgclient
    06/28/2011 02:48 AM <DIR> City Interactive
    06/30/2011 04:53 AM <DIR> Common Files
    07/10/2011 09:18 PM <DIR> Deus Ex HR Preview Build
    06/23/2011 06:36 PM <DIR> Intel
    06/24/2011 09:03 AM <DIR> Internet Explorer
    06/30/2011 04:52 AM <DIR> Java
    07/09/2011 12:10 AM <DIR> JMF2.1.1e
    06/23/2011 07:16 PM <DIR> Kaspersky Lab
    07/07/2011 01:23 AM <DIR> Luxor 3
    06/25/2011 10:33 PM <DIR> Microsoft Analysis Services
    06/25/2011 10:35 PM <DIR> Microsoft Office
    07/03/2011 07:53 AM <DIR> Microsoft SQL Server
    06/25/2011 10:35 PM <DIR> Microsoft SQL Server Compact Edition
    06/25/2011 10:35 PM <DIR> Microsoft Sync Framework
    06/25/2011 10:36 PM <DIR> Microsoft Synchronization Services
    06/25/2011 10:34 PM <DIR> Microsoft Visual Studio 8
    06/25/2011 10:35 PM <DIR> Microsoft.NET
    06/24/2011 11:43 PM <DIR> Mozilla Firefox
    06/25/2011 10:36 PM <DIR> MSBuild
    07/08/2011 02:40 PM <DIR> NCH Swift Sound
    06/30/2011 04:57 AM <DIR> NetBeans 7.0
    06/23/2011 06:48 PM <DIR> NVIDIA Corporation
    06/23/2011 06:53 PM <DIR> Realtek
    07/13/2009 10:32 PM <DIR> Reference Assemblies
    07/03/2011 07:49 AM <DIR> Sony
    07/03/2011 07:48 AM <DIR> Sony Setup
    06/24/2011 04:38 AM <DIR> TouchFreeze
    06/24/2011 05:16 AM <DIR> uTorrent
    07/03/2011 07:50 AM <DIR> Vstplugins
    07/11/2011 09:58 PM <DIR> Warcraft III 120c
    07/13/2009 10:37 PM <DIR> Windows Defender
    06/24/2011 09:03 AM <DIR> Windows Mail
    06/24/2011 09:03 AM <DIR> Windows Media Player
    07/13/2009 10:32 PM <DIR> Windows NT
    07/13/2009 10:37 PM <DIR> Windows Photo Viewer
    07/13/2009 10:32 PM <DIR> Windows Portable Devices
    07/13/2009 10:37 PM <DIR> Windows Sidebar
    0 File(s) 0 bytes
    45 Dir(s) 424,346,169,344 bytes free

    C:\Program Files (x86)>cd\program files*86*\java

    C:\Program Files (x86)\Java>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Program Files (x86)\Java

    06/30/2011 04:52 AM <DIR> .
    06/30/2011 04:52 AM <DIR> ..
    06/30/2011 04:53 AM <DIR> jdk1.6.0_26
    06/30/2011 04:53 AM <DIR> jre6
    0 File(s) 0 bytes
    4 Dir(s) 424,346,169,344 bytes free

    C:\Program Files (x86)\Java>java -jar KKK.jar
    'java' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files (x86)\Java>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Program Files (x86)\Java

    06/30/2011 04:52 AM <DIR> .
    06/30/2011 04:52 AM <DIR> ..
    06/30/2011 04:53 AM <DIR> jdk1.6.0_26
    06/30/2011 04:53 AM <DIR> jre6
    0 File(s) 0 bytes
    4 Dir(s) 424,345,645,056 bytes free

    C:\Program Files (x86)\Java>cd\program files*86*\java\bin
    The system cannot find the path specified.

    C:\Program Files (x86)\Java>cd\program files*86*\java\jdk1.6.0_26

    C:\Program Files (x86)\Java\jdk1.6.0_26>dor
    'dor' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files (x86)\Java\jdk1.6.0_26>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Program Files (x86)\Java\jdk1.6.0_26

    06/30/2011 04:53 AM <DIR> .
    06/30/2011 04:53 AM <DIR> ..
    06/30/2011 04:51 AM <DIR> bin
    05/04/2011 07:03 AM 3,409 COPYRIGHT
    06/30/2011 04:52 AM <DIR> demo
    06/30/2011 04:51 AM <DIR> include
    06/30/2011 04:52 AM <DIR> jre
    06/30/2011 04:52 AM <DIR> lib
    06/30/2011 04:51 AM 41 LICENSE
    06/30/2011 04:51 AM 125 README.html
    06/30/2011 04:52 AM 5,360 register.html
    06/30/2011 04:52 AM 6,818 register_ja.html
    06/30/2011 04:52 AM 4,950 register_zh_CN.html
    06/30/2011 04:52 AM <DIR> sample
    05/04/2011 07:04 AM 19,718,944 src.zip
    06/30/2011 04:51 AM 186,655 THIRDPARTYLICENSEREADME.txt
    8 File(s) 19,926,302 bytes
    8 Dir(s) 424,345,645,056 bytes free

    C:\Program Files (x86)\Java\jdk1.6.0_26>cd\program files*86*\java\jdk1.6.0_26

    C:\Program Files (x86)\Java\jdk1.6.0_26>java -jar KKK.jar
    'java' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files (x86)\Java\jdk1.6.0_26>cd\program files*86*\java\jdk1.6.0_26\bi
    n

    C:\Program Files (x86)\Java\jdk1.6.0_26\bin>dir
    Volume in drive C has no label.
    Volume Serial Number is 7C80-F20B

    Directory of C:\Program Files (x86)\Java\jdk1.6.0_26\bin

    06/30/2011 04:51 AM <DIR> .
    06/30/2011 04:51 AM <DIR> ..
    06/30/2011 04:51 AM 33,536 appletviewer.exe
    06/30/2011 04:51 AM 33,536 apt.exe
    06/30/2011 04:51 AM 30,208 beanreg.dll
    06/30/2011 04:51 AM 33,536 extcheck.exe
    06/30/2011 04:51 AM 55,040 HtmlConverter.exe
    06/30/2011 04:51 AM 33,536 idlj.exe
    06/30/2011 04:51 AM 33,536 jar.exe
    06/30/2011 04:51 AM 33,536 jarsigner.exe
    06/30/2011 04:51 AM 33,536 java-rmi.exe
    06/30/2011 04:51 AM 145,152 java.exe
    06/30/2011 04:51 AM 33,536 javac.exe
    06/30/2011 04:51 AM 33,536 javadoc.exe
    06/30/2011 04:51 AM 33,536 javah.exe
    06/30/2011 04:51 AM 33,536 javap.exe
    06/30/2011 04:51 AM 145,152 javaw.exe
    06/30/2011 04:51 AM 157,440 javaws.exe
    06/30/2011 04:51 AM 34,048 jconsole.exe
    06/30/2011 04:51 AM 33,536 jdb.exe
    06/30/2011 04:51 AM 33,536 jhat.exe
    06/30/2011 04:51 AM 33,536 jinfo.exe
    06/30/2011 04:51 AM 77,824 jli.dll
    06/30/2011 04:51 AM 33,536 jmap.exe
    06/30/2011 04:51 AM 33,536 jps.exe
    06/30/2011 04:51 AM 33,536 jrunscript.exe
    06/30/2011 04:51 AM 33,536 jstack.exe
    06/30/2011 04:51 AM 33,536 jstat.exe
    06/30/2011 04:51 AM 33,536 jstatd.exe
    06/30/2011 04:51 AM 47,360 jvisualvm.exe
    06/30/2011 04:51 AM 33,536 keytool.exe
    06/30/2011 04:51 AM 33,536 kinit.exe
    06/30/2011 04:51 AM 33,536 klist.exe
    06/30/2011 04:51 AM 33,536 ktab.exe
    06/30/2011 04:51 AM 348,160 msvcr71.dll
    06/30/2011 04:51 AM 33,536 native2ascii.exe
    06/30/2011 04:51 AM 33,536 orbd.exe
    06/30/2011 04:51 AM 33,536 pack200.exe
    06/30/2011 04:51 AM 79,616 packager.exe
    06/30/2011 04:51 AM 33,536 policytool.exe
    06/30/2011 04:51 AM 33,536 rmic.exe
    06/30/2011 04:51 AM 33,536 rmid.exe
    06/30/2011 04:51 AM 33,536 rmiregistry.exe
    06/30/2011 04:51 AM 33,536 schemagen.exe
    06/30/2011 04:51 AM 33,536 serialver.exe
    06/30/2011 04:51 AM 33,536 servertool.exe
    06/30/2011 04:51 AM 33,536 tnameserv.exe
    06/30/2011 04:51 AM 132,864 unpack200.exe
    06/30/2011 04:51 AM 33,536 wsgen.exe
    06/30/2011 04:51 AM 33,536 wsimport.exe
    06/30/2011 04:51 AM 33,536 xjc.exe
    49 File(s) 2,527,232 bytes
    2 Dir(s) 424,345,116,672 bytes free

    C:\Program Files (x86)\Java\jdk1.6.0_26\bin>java -jar KKK.jar
    Unable to access jarfile KKK.jar

    C:\Program Files (x86)\Java\jdk1.6.0_26\bin>
    please pardon me if i dont make it right.. but this is what ive got for now

  13. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    C:\Program Files (x86)\Java\jdk1.6.0_26\bin>java -jar KKK.jar
    Unable to access jarfile KKK.jar
    You need to be in the directory with the KKK.jar file when you issue the java command?

    There is something wrong with your installation of java if the java command is not found.
    Or you need to add the path to the java command to the PATH environment variable.
    The PATH environment variable is set from the Settings | Control Panel | System panel.
    Select the Advanced tab and
    Click on the Environment variable's button.
    At the bottom in System Variables, find the PATH entry and click the Edit button
    Add the new path using ; to separate it
    Its a stupid small text field so be careful.

  14. #14
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    i can only find the KKK.jar inside the netbeans project/<myProject>/dist but i cant use the java command, ok ill try to install the path for the environment variable

  15. #15
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    finnally! i got i!
    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Zabdiel>javac
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files and annotati
    on processors
    -cp <path> Specify where to find user class files and annotati
    on processors
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -proc:{none,only} Control whether annotation processing and/or compil
    ation is done.
    -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t
    o run; bypasses default discovery process
    -processorpath <path> Specify where to find annotation processors
    -d <directory> Specify where to place generated class files
    -s <directory> Specify where to place generated source files
    -implicit:{none,class} Specify whether or not to generate class files for
    implicitly referenced files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release

    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -Akey[=value] Options to pass to annotation processors
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system


    C:\Users\Zabdiel>java -jar KKK.jar
    Unable to access jarfile KKK.jar

    C:\Users\Zabdiel>cd\users\zabdiel\My Documents

    C:\Users\Zabdiel\My Documents>cd\users\zabdiel\My Documents\Netbeans Projects
    The system cannot find the path specified.

    C:\Users\Zabdiel\My Documents>cd\users\zabdiel\My Documents\NetbeansProjects

    C:\Users\Zabdiel\My Documents\NetbeansProjects>cd\users\zabdiel\My Documents\Net
    beans Projects\dist
    The system cannot find the path specified.

    C:\Users\Zabdiel\My Documents\NetbeansProjects>cd\users\zabdiel\My Documents\Net
    beansProjects\KKK

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK>cd\users\zabdiel\My Documents
    \NetbeansProjects\KKK\dist

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>java -jar KKK.jar
    javax.media.NoPlayerException: Cannot find a Player for :jar:file:/C:/Users/Zabd
    iel/My%20Documents/NetbeansProjects/KKK/dist/KKK.jar!/kkk/KKKFOLDER/Opening.mp3
    at javax.media.Manager.createPlayerForContent(Manager .java:1412)
    at javax.media.Manager.createPlayer(Manager.java:417)
    at javax.media.Manager.createPlayer(Manager.java:332)
    at javax.media.Manager.createRealizedPlayer(Manager.j ava:527)
    at kkk.MainBackgroundSound.playMusic(MainBackgroundSo und.java:28)
    at kkk.OpeningWindows$OpeningWindowPanel.<init>(Openi ngWindows.java:96)
    at kkk.OpeningWindows.initComponents(OpeningWindows.j ava:43)
    at kkk.OpeningWindows.<init>(OpeningWindows.java:35)
    at kkk.OpeningWindows.main(OpeningWindows.java:451)
    Exception in thread "main" java.lang.NullPointerException
    at kkk.MainBackgroundSound.playMusic(MainBackgroundSo und.java:35)
    at kkk.OpeningWindows$OpeningWindowPanel.<init>(Openi ngWindows.java:96)
    at kkk.OpeningWindows.initComponents(OpeningWindows.j ava:43)
    at kkk.OpeningWindows.<init>(OpeningWindows.java:35)
    at kkk.OpeningWindows.main(OpeningWindows.java:451)

    C:\Users\Zabdiel\My Documents\NetbeansProjects\KKK\dist>

  16. #16
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    and finnaly! i located the problem the JMF!! omg, i need to play the mp3 file, i added the jar file of the framework properly in the IDE, what should i do next for deploying the project together with it as jar?

  17. #17
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    now tons errors is popping up that i never had inside the IDE

  18. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    Yes, the IDE is like your mother protecting you from the real world. Time to learn how things really work.

  19. The Following User Says Thank You to Norm For This Useful Post:

    chronoz13 (July 11th, 2011)

  20. #19
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: jar file Built(clean and build) perfectly, but not running as jar

    and thanks for the help again thanks so much, learned alot again thanks

Similar Threads

  1. Help with running class file
    By carface in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 30th, 2010, 05:40 PM
  2. Replies: 4
    Last Post: September 5th, 2010, 10:29 AM
  3. Struts Application, Complies perfectly but error at run time
    By Prarthana in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 18th, 2010, 01:49 AM
  4. Problems with XPathExpression on memory built Document
    By JRSofty in forum File I/O & Other I/O Streams
    Replies: 5
    Last Post: December 12th, 2009, 08:18 PM
  5. How to build a .car file in Vignette?
    By andrew222 in forum Java Theory & Questions
    Replies: 2
    Last Post: November 22nd, 2009, 04:49 PM