Results 1 to 10 of 10
- 08-22-2013, 12:23 PM #1
Member
- Join Date
- May 2010
- Posts
- 30
- Rep Power
- 0
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
- 08-22-2013, 12:41 PM #2
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
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
- 08-22-2013, 01:07 PM #3
Member
- Join Date
- May 2010
- Posts
- 30
- Rep Power
- 0
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??
- 08-22-2013, 01:21 PM #4
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
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
- 08-22-2013, 01:32 PM #5
Member
- Join Date
- May 2010
- Posts
- 30
- Rep Power
- 0
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 :)
- 08-22-2013, 01:48 PM #6
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
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);
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
- 08-22-2013, 02:05 PM #7
Member
- Join Date
- May 2010
- Posts
- 30
- Rep Power
- 0
Re: package does not exists - netbeans
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
- 08-22-2013, 02:27 PM #8
Re: package does not exists - netbeans
Please go through the http://www.java-forums.org/forum-gui...w-members.html and BB Code List - Java Programming Forum - Learn Java Programming and then post the code and any error messages here on the forum.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
- 08-22-2013, 05:12 PM #9
Member
- Join Date
- May 2010
- Posts
- 30
- Rep Power
- 0
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.
- 08-22-2013, 06:37 PM #10
Re: package does not exists - netbeans
I guess you need ot go through this Lesson: Packages (The Java™ Tutorials > Learning the Java Language)
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
Similar Threads
-
Eclipse package classes are not visible - deleting package completely - checkstyle
By compauer in forum EclipseReplies: 3Last Post: 03-27-2012, 09:27 AM -
package com.sun.java_cup.internal does not exists
By pink123 in forum New To JavaReplies: 2Last Post: 09-16-2011, 03:20 PM -
Package Problems in NetBeans IDE
By farmer in forum NetBeansReplies: 2Last Post: 08-24-2011, 06:35 PM -
package org.jdesktop.jdic.browser does not exists
By pink123 in forum New To JavaReplies: 1Last Post: 08-18-2011, 06:58 PM -
NetBeans losing package information when crashing
By Kethas in forum New To JavaReplies: 4Last Post: 03-03-2010, 05:38 AM
Bookmarks