Referencing Horizontal Java Packages
NickName:SeaNick Ask DateTime:2014-05-05T03:17:19

Referencing Horizontal Java Packages

I'm not sure why I can't process this right now, but I have four packages in one source folder:

./src/common
./src/server
./src/client
./src/unittest

Common uses no files from any of the others, but server and client use files from the common package. In each of the files in those packages I have import common.*. But when I run the compiler with javac ./src/server/*.java it can't find the common package.

The only info I can seem to find is for tree structured package hierarchies, but how do I reference something at the same folder height as me? Do I need to nest common inside both server and client? That seems likely to generate a lot of redundant code.

I'm sure this is probably a question someone has asked before, so I apologize, but I cannot find it anywhere.

Copyright Notice:Content Author:「SeaNick」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/23460478/referencing-horizontal-java-packages

More about “Referencing Horizontal Java Packages” related questions

Referencing Horizontal Java Packages

I'm not sure why I can't process this right now, but I have four packages in one source folder: ./src/common ./src/server ./src/client ./src/unittest Common uses no files from any of the others, ...

Show Detail

Circular Referencing Packages - Python/Django

During the course of a GraphQL implementation I'm finding myself making a lot of circular references to keep the packages modular. Consider the following folder structure. project/ __init__.py

Show Detail

Referencing packages in java without using String

Is there a way to reference a package in java in code without using a String? Let me explain myself: I've a function that fetches all object contained in a package, but I've to reference that pac...

Show Detail

Referencing packages from another java project in a jsf project

I'm working on a JSF project. There's another project that has a lot of packages with some functionaly that I'd like to use, but when I add the references of these packages in my jsf project, it st...

Show Detail

Referencing wrong jar file in java build-path

In my project we are referencing lot of dependency .jar files. /lib/xxx.jar /lib/abc.jar The xxx.jar file having some (com.search.hit) packages. The same packages are available in abc.jar file....

Show Detail

Referencing External Java and Android Libraries

I am trying to reference a Java and an Android library (that I created) to use within my Android application built in Eclipse. I am referencing the Java library via Properties-->Java Build Path-->

Show Detail

Forward referencing in Java

I have a method: void foo() { int y = 5 + x; int x = 2; } Will it compile or not?? I think it should. They say Java support forward referencing i.e. I can use a variable before it is declared...

Show Detail

Solution uses PackageReference, but getting compile error referencing packages.config

My solution has two projects - proj1 and proj2, which references proj1. I just converted the solution from packages.config to PackageReference, now when I build the solution, proj2 fails to compile...

Show Detail

Eclipse Doesn't List Classes Within Java Packages

Usually when I'm typing a Java import statement in Eclipse or otherwise referencing a class via the packages that it is in, Eclipse shows a context menu with a list of all classes within that packa...

Show Detail

MATLAB Java referencing problem

I have a MATLAB class which contains a reference to a java object classdef MyClass properties j = myJavaClass end methods ... end end and after I use it (using clear, scope exit or

Show Detail