Results 1 to 19 of 19

Thread: Can't compile

  1. #1
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Can't compile

    I am trying to compile a Java project, I am new to Java but I have a basic/good programming logic. (did some AS3, PHP+MySQL here and there).
    I basically made some changes to .java files, then compiled to .jar. (did this in "eclipse-java-europa-winter-win32") When I run the .jar I get an error:
    "Exception in thread 'main' java.lang.noclassdeffounderror: ch/ubique/inieditor/IniEditor"

    When I compile the Default files without making any changes, I get the same error. - that's why I think its a compiling problem / me not knowing Java

    The files / project are right here:
    gatherbot_rlease.zip - tf2gatherbot - Gather Bot stable rlease - Team Fortress 2 IRC Gather Bot - Google Project Hosting


    If someone could please point out what the problem is / what Newbie mistake I am making

    Thanks in advance,
    Trath

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Can't compile

    Please post the full text of the error messages and the code that is causing them. Copy and paste the messages, don't type them in, so there is full text and correct spelling.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    D:\GatherBot>java -jar d.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: ch/ubique/inieditor/I
    niEditor
    at Main.main(Main.java:15)
    Caused by: java.lang.ClassNotFoundException: ch.ubique.inieditor.IniEditor
    at java.net.URLClassLoader$1.run(Unknown Source)
    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(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 1 more

    D:\GatherBot>

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Can't compile

    Caused by: java.lang.ClassNotFoundException: ch.ubique.inieditor.IniEditor
    That's a runtime error, not a compiler error.

    Where is the class mentioned in the error message? The java program can not find it.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Can't compile

    Yep.
    Is that class in the jar file?
    Looks like it isn't.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    Yes, I have inieditor.jar in the .classpath just as some other classes are used.

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Can't compile

    No.
    Is that class in the d.jar file you seem to be trying to run?
    Is it in the ch/ubique/inieditor "folder" in the jar?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    The class is in iniedtior.jar which is in the "libs" folder. The .classpath references to that jar file.

    Just like the sqlite class is in "sqlitejdbc-v056.jar" which is refrenced in the .classpath .

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Can't compile

    Can you open a command prompt window and enter: SET
    which will print out the values of all the environment variables. Copy the value for CLASSPATH here.
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    D:\GatherBot>SET
    ALLUSERSPROFILE=C:\ProgramData
    AMDAPPSDKROOT=C:\Program Files (x86)\AMD APP\
    APPDATA=C:\Users\Yoni\AppData\Roaming
    asl.log=Destination=file
    CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
    CommonProgramFiles=C:\Program Files\Common Files
    CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
    CommonProgramW6432=C:\Program Files\Common Files
    COMPUTERNAME=YONI-PC
    ComSpec=C:\Windows\system32\cmd.exe
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Users\Yoni
    LOCALAPPDATA=C:\Users\Yoni\AppData\Local
    LOGONSERVER=\\YONI-PC
    NUMBER_OF_PROCESSORS=8
    OS=Windows_NT
    Path=C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bi
    n\x86;C:\Windows\system32;C:\Windows;C:\Windows\Sy stem32\Wbem;C:\Windows\System3
    2\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-S
    tatic;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Autodesk
    \Backburner\;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files (x8
    6)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\10
    0\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Fil
    es (x86)\Java\jdk1.7.0_06\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WS F;.WSH;.MSC
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 26 Stepping 5, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=1a05
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files
    PROMPT=$P$G
    PSModulePath=C:\Windows\system32\WindowsPowerShell \v1.0\Modules\
    PUBLIC=C:\Users\Public
    QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\Windows
    TEMP=C:\Users\Yoni\AppData\Local\Temp
    TMP=C:\Users\Yoni\AppData\Local\Temp
    USERDOMAIN=Yoni-PC
    USERNAME=Yoni
    USERPROFILE=C:\Users\Yoni
    VS100COMNTOOLS=d:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools
    \
    windir=C:\Windows

    D:\GatherBot>

  11. #11
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    btw:
    When I choose the "run" option and then "Java Application" and choose "Main", it seems to be working in the console.
    Yet still when compiled, same error.

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Can't compile

    Here is the CLASSPATH from your PC
    CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
    Where are the jar files with the missing classes?
    What did you mean when you said:
    The .classpath references to that jar file.
    If you don't understand my response, don't ignore it, ask a question.

  13. #13
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    I mean theres a file called ".classpath" that says this:
    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    	<classpathentry kind="src" path="src"/>
    	<classpathentry kind="lib" path="libs/gameserver-2010-03-17.jar"/>
    	<classpathentry exported="true" kind="lib" path="libs/inieditor.jar"/>
    	<classpathentry kind="lib" path="libs/jdom.jar"/>
    	<classpathentry kind="lib" path="libs/mysql-connector-java-5.1.12-bin.jar"/>
    	<classpathentry kind="lib" path="libs/pircbot.jar"/>
    	<classpathentry kind="lib" path="libs/QueriEd.jar"/>
    	<classpathentry kind="lib" path="libs/RconEd.jar"/>
    	<classpathentry kind="lib" path="libs/sqlitejdbc-v056.jar"/>
    	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    	<classpathentry kind="lib" path="/DefaultBot/libs/inieditor-r2.jar"/>
    	<classpathentry kind="output" path="bin"/>
    </classpath>
    Maybe its just for eclipse? anyway, it refrences all the .jar librarys to be used.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Can't compile

    its just for eclipse, the java command does not use it.
    If you don't understand my response, don't ignore it, ask a question.

  15. #15
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Can't compile

    Not only that the CLASSPATH environment variable (apart from being a bad thing to use for your classpath) is not used when executing jar files with the -jar switch.
    The classpath used for that is held in the MANIFEST.

    So, does the manifest in the jar file list those jars?
    I'm guessing not.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  16. #16
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    Then how do I fix the problem?

    I don't care what I compile with, as long as it works.

  17. #17
    trath is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Re: Can't compile

    Quote Originally Posted by Tolls View Post
    Not only that the CLASSPATH environment variable (apart from being a bad thing to use for your classpath) is not used when executing jar files with the -jar switch.
    The classpath used for that is held in the MANIFEST.

    So, does the manifest in the jar file list those jars?
    I'm guessing not.
    I chose the "save manifest to file" in eclipse, it says this when opened with notepad:
    Java Code:
    Manifest-Version: 1.0
    Sealed: true
    Main-Class: Main

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default Re: Can't compile

    If you don't understand my response, don't ignore it, ask a question.

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Can't compile

    If you want to generate an executable jar, along with its dependencies, in Eclipse then this is an Eclipse question and should be moved to that forum.
    If you want to try this by hand (using the link Norm provides) then it can remain here.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. why i can not compile? please help
    By zypchun in forum New To Java
    Replies: 4
    Last Post: 09-29-2013, 10:11 PM
  2. why won't this compile
    By joet1984 in forum Advanced Java
    Replies: 4
    Last Post: 08-31-2011, 09:50 AM
  3. What to do here(cant compile)?
    By Pojahn_M in forum New To Java
    Replies: 8
    Last Post: 08-06-2011, 01:55 AM
  4. would this compile?
    By stringkilla in forum New To Java
    Replies: 10
    Last Post: 10-24-2010, 03:27 PM
  5. Help with compile
    By mr_anderson in forum NetBeans
    Replies: 7
    Last Post: 06-10-2010, 04:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •