Questions tagged [default-package]

15 questions
102
votes
5 answers

How to access java-classes in the default-package?

I'm working now together with others in a grails project. I have to write some Java-classes. But I need access to an searchable object created with groovy. It seems, that this object has to be placed in the default-package. My question is: Is there…
Mnementh
  • 47,129
  • 42
  • 140
  • 198
102
votes
9 answers

How to import a class from default package

Possible Duplicate: How to access java-classes in the default-package? I am using Eclipse 3.5 and I have created a project with some package structure along with the default package. I have one class in default package - Calculations.java and I…
Michał Ziober
  • 31,576
  • 17
  • 81
  • 124
23
votes
3 answers

What is the default package in which my classes are put if I don't specify it?

Let's assume I have a file named Main.java with the following code: public class Main { public static void main(String[] args) { System.out.println("Hello world"); } } Is it put in a specific package, in (maybe?) an unnamed…
devoured elysium
  • 90,453
  • 117
  • 313
  • 521
9
votes
1 answer

How to run Dropwizard app in debug mode with Eclipse?

I'm looking to run my Dropwizard 0.8.5 app in debug mode whereby: The app is running locally, using JPDA; and In my IDE (Eclipse) I set breakpoints and use a JPDA client to connect to my locally running app (I think this is how it goes) For the…
smeeb
  • 22,487
  • 41
  • 197
  • 389
3
votes
6 answers

Why shouldn't we use the (default)src package?

I recently started using Eclipse IDE and have read at a number of places that one shouldn't use the default(src) package and create new packages. I just wanted to know the reason behind this.
YetAnotherG33k
  • 242
  • 3
  • 7
2
votes
0 answers

Changing lua default package

I'm currently running Ubuntu and I'm having a problem with lua. When I try to run my project with cmake, it says LUA_LIBRARY-NOTFOUND. However, I did install lua, and when I check in my /usr/include folder, I can see that lua is there. But I have…
BenoitBo
  • 21
  • 3
2
votes
2 answers

Why use of default package is not recommended in JAVA?

Why is it not recommended to use default package in JAVA? Though I understand it makes more sense to have a more reasonable and descriptive package names for maintainability and readability purposes, but are there any other reasons behind it?
aamir
  • 3,053
  • 3
  • 17
  • 31
1
vote
0 answers

How can I import classes that are located inside a referenced library?

I've created a .jar file with the classes I need for my project. I created the build path for that .jar file. However, I cannot use the classes inside the referenced library that was created. So far, as I can tell, the problem is that my files…
0
votes
1 answer

I get a class not found exception when i rename the package from "default package"

I get a class not found exception when i rename the package from "default package" in java. When i run the code within the default package, the code works fine but when i paste the code into a new java project in eclipse and into a new package,…
DEKE
  • 31
  • 3
0
votes
1 answer

How to access a Java class in the default package from jshell?

I am unable to access Java classes in the default package from jshell. I cannot import since the default package has no name and when I try to reference the name then I have an error: jshell> Test.test(); | Error: | cannot find symbol | …
Pierre Thibault
  • 1,555
  • 2
  • 16
  • 19
0
votes
1 answer

About java default package(using Eclipse)

Now, I'm using some methods by using a jar. But these classes I use have no package names. I can use reflection to solve the problem of using these methods.But now I want to override some of the interface and classes. However,others can extends…
0
votes
1 answer

How to add prefixes to jni dll function names

I have a jni dll that has functions being called from java. The problem is that this dll has all the java classes in the default package (in the dll "Java_classname_methodname"). It is impossible to get the source of this dll and it would take…
0
votes
1 answer

loading config file from default package vs from classpath

I'm getting a crazy error while loading a config file in a JAX-RS application on jetty. public class Configuration { public static final Properties config = new Properties(); static { config.clear(); try (InputStream…
Majid Azimi
  • 5,009
  • 12
  • 56
  • 100
0
votes
1 answer

How can i call a JFrame from a class?

I have an project which have a Jframe under a default package.I cant call the jframe from a another main class . public class NewJFrame extends javax.swing.JFrame { /** * Creates new form NewJFrame */ public NewJFrame() { …
0
votes
1 answer

tomcat eclipse java ee default package

I'm trying to set up a dynamic web app using Eclipse Juno and Tomcat 7. My problem is that i can only get my servlet to run if my file structure is MyProject/Java Rescources/src/(default package)/MyServlet.java I've read i should avoid using the…