Results 1 to 10 of 10
  1. #1
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default package does not exists - netbeans

    Hi, Trying to add a library to a java project.

    The original library didn't have a package for the classes, it was all in a <default package>
    So I opened the jar archive, put the classes in a new folder and made a .jar file again.
    Now my classes are jarred within a 'stdlib' folder. Added to all clasess 'package stdlib;' on top of the text.

    But: http://s9.postimg.org/pjzebpz33/lib.jpg

    netbeans says - package does not exist.
    The library is added to the project.
    There is a folder with the corresponding name inside the jar, containing the referenced classes.
    Finally, don't know what to do now, except dragging the classes needed into my project sources :)

    Best Regards
    Attached Thumbnails Attached Thumbnails package does not exists - netbeans-lib.jpg  

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,709
    Rep Power
    5

    Default Re: package does not exists - netbeans

    it doesn't contain classes, it contains java source files apparently.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default Re: package does not exists - netbeans

    Thx,
    I compiled some classes I need and it works.
    But when trying to compile some of the other classes, I get an error like this:
    ---
    E:\workspace\alg4e\stdlib_>javac BinaryStdIn.java
    BinaryStdIn.java:261: error: cannot find symbol
    BinaryStdOut.write(c);
    ^
    symbol: variable BinaryStdOut
    location: class BinaryStdIn
    BinaryStdIn.java:263: error: cannot find symbol
    BinaryStdOut.flush();
    ^
    symbol: variable BinaryStdOut
    location: class BinaryStdIn
    ---
    It refers to the class 'BinaryStdOut', which is allready compiled and present as 'BinaryStdOut.class' file in my package/folder.
    What could be wrong??

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,709
    Rep Power
    5

    Default Re: package does not exists - netbeans

    Do those classes in the stdlib package actually have a package statement at the top of them?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default Re: package does not exists - netbeans

    all of them do.
    manually added 'package stdlib;' in the .java files.
    Sometimes I get ciricular references.
    Trying to compile class A yields some ref. to Class B error, Trying to compile Class B prints some ref. to Class A error :)

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,709
    Rep Power
    5

    Default Re: package does not exists - netbeans

    post the code of those classes that don't compile, because they obviously contain mistakes. Take a look at the error you are getting and the line of code it points to:

    Java Code:
    BinaryStdOut.write(c);
    symbol: variable BinaryStdOut

    variable? BinaryStdOut is a classname, not a variable. I would expect the code to be more like:

    Java Code:
    BinaryStdOut stdOut = new BinaryStdOut(...);
    
    stdout.write(c);
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default Re: package does not exists - netbeans

    Quote Originally Posted by emosms View Post
    Thx,
    I compiled some classes I need and it works.
    But when trying to compile some of the other classes, I get an error like this:
    ---
    E:\workspace\alg4e\stdlib_>javac BinaryStdIn.java
    BinaryStdIn.java:261: error: cannot find symbol
    BinaryStdOut.write(c);
    ^
    symbol: variable BinaryStdOut
    location: class BinaryStdIn
    BinaryStdIn.java:263: error: cannot find symbol
    BinaryStdOut.flush();
    ^
    symbol: variable BinaryStdOut
    location: class BinaryStdIn
    ---
    It refers to the class 'BinaryStdOut', which is allready compiled and present as 'BinaryStdOut.class' file in my package/folder.
    What could be wrong??
    BinaryStdOut is successfully compiled. Source:
    Free Text Host - The Anonymous Text Hosting Service - No Registration Required
    BinaryStdIn won't compile:
    Free Text Host - The Anonymous Text Hosting Service - No Registration Required
    - Both declared as final classes, static methods only, no instantiation

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: package does not exists - netbeans

    Please go through the Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming and then post the code and any error messages here on the forum.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default Re: package does not exists - netbeans

    Ok, I will consider that - BB code. Eventhough it makes the post insanely big if I post all the code inside.
    Got the problem:
    The classes have package specified, so the new class to be compiled is looking for the source to be in a direcory named as the package declared.
    That's why there are errors, it does not find the referred classes (variables?) in such a directory.
    ---
    Still cannot figure out how to make it in a batch.
    If I use the jar -d option and set a directory, it places the file in a new directory with the same name within my existing package directory.
    The package directory with the coresponding package name MUST exist in advance.
    So again, with this option the files created are one step deeper and it seems completely ridiculous behavior to me.
    Last edited by emosms; 08-22-2013 at 05:14 PM.

  10. #10
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: package does not exists - netbeans

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 3
    Last Post: 03-27-2012, 09:27 AM
  2. package com.sun.java_cup.internal does not exists
    By pink123 in forum New To Java
    Replies: 2
    Last Post: 09-16-2011, 03:20 PM
  3. Package Problems in NetBeans IDE
    By farmer in forum NetBeans
    Replies: 2
    Last Post: 08-24-2011, 06:35 PM
  4. package org.jdesktop.jdic.browser does not exists
    By pink123 in forum New To Java
    Replies: 1
    Last Post: 08-18-2011, 06:58 PM
  5. NetBeans losing package information when crashing
    By Kethas in forum New To Java
    Replies: 4
    Last Post: 03-03-2010, 05:38 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
  •