Skip to content

Tag: package

Why is package-protected method not visible in the same package?

Assume we have two packages p1 and p2 and classes p1.M1 extended by p2.M12 as follows: Let’s extend M12 with p2.B: This gives a compilation error as method1, being package-protected within p1 is not visible in p2. method2 is visible without problems. Now let’s extend p2.M12 with p1.A: Here I&#8217…

Package org.jboss.netty.channel.socket.nio does not exist

Which JAR contains org.jboss.netty.channel.socket.nio? I’m not using Maven or Ivy, just Ant. Ant compile gives: In the classpath is: The library is netty-4.0.21.Final.tar.bz2, which was downloaded from the official Netty website. I added each JAR from that download to the project. Yes, I realize it&#821…

Import project (jar) into Eclipse

I got a .jar file which I need to import into Eclipse. However, I don’t want to have the jar as a referenced library. I need the .jar to be included like a “normal” project, with packages(!) and .java files. I tried to do the following: New Java project -> Import -> General -> Archi…

Importing packages in Java

How to import a method from a package into another program? I don’t know how to import… I write a lil’ code: and then, saved it in a folder named “Dan” and I compiled it. The .class file is generated. Then, I wrote this code below: and I saved it outside the folder “Dan&#82…

Is my package structure correct?

What should be the hierarchy of packages? Is this package structure appropriate? Answer I am actually against layer-driven packaging but instead I advice feature-driven approach: The reasoning is: you’ll much more often want to have all classes related to person functionality in one place. Not often you…

Java Package Does Not Exist Error

So there’s a folder /usr/share/stuff in the root directory in stuff there are a bunch of java files with package org.name definitions at the top I am running javac test.java where test.java is in a subdomain I added /usr/share/stuff to my class path. and at the top of test.java I add import org.name But…

Why is my Eclipse Java package being treated as a folder?

My Eclipse Java package is treated as a folder; can anyone suggest what’s wrong? Answer Worst case, you’ll have to delete the folder and recreate as a java package. Save the Java classes somewhere else in your Java project by refactoring Delete the folder and the underlying folder structure Create…