J2EE BluePrints: correct location for common Java source files

I have a set of Java source files that are common between multiple J2EE applications.
Within the J2EE package hierarchy, what is the correct location for these files?
Also, is there a typical package name that common Java source files are grouped under?

HI,
There is no standard place. In the blueprints project conventons
http://java.sun.com/blueprints/code/projectconventions.html it has a place called components/ which would contain shared components like EJBs and other components that could be shared across applications. the package naming would be reflected in that, like com.sun.blueprints.application1. and com.sun.blueprints.application2. and com.sun.blueprints.common.*
Generally you could put a directory at the same level as the apps (not inside an app's directory structure) and maybe called common/ or shared/ . This common code could be built separtely and into a binary library or jar that you just include in the other applicatons, in the same way you would include some external library jar that you got somewhere and keep in your workspace and your apps use. The packaging of common code is similiar to the packaging of different applications and shared components.
hth,
Sean

Similar Messages

  • Access Java Proposals for a java source code programmatically

    Hi,
    Problem
    Programmatically get java proposals for a java source code (not byte code) via eclipse bundle
    Description
    I am developing one eclipse osgi bundle to correct java source code automatically. I am running osgi bundle inside eclipse itself [Version: Mars Release (4.5.0)]. I am able to get java project object and a class object inside it which I want to correct. Every time I try to collect java code proposals as I put one test file which can be corrected (like duplicate imports), I receive below error:
    Java code line
    JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { problem }, proposals);
    Error description
    !ENTRY org.eclipse.jdt.ui 4 2 2015-07-27 18:57:09.196
    !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui".
    !STACK 0
    java.lang.IllegalStateException: Workbench has not been created yet.
    at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.install(ASTProvider.java:236)
    at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.<init>(ASTProvider.java:227)
    at org.eclipse.jdt.internal.ui.JavaPlugin.getASTProvider(JavaPlugin.java:741)
    at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
    at org.eclipse.jdt.internal.ui.text.correction.AssistContext.getASTRoot(AssistContext.java:119)
    at org.eclipse.jdt.internal.ui.text.correction.LocalCorrectionsSubProcessor.addUnusedMemberProposal(LocalCorrectionsSubProcessor.java:669)
    at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:530)
    at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:316)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:378)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:339)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:335)
    at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:468)

    Any code from org.eclipse.jdt.ui (or the non-API code in org.eclipse.jdt.internal.ui) is likely to require a running workbench. Only the code from org.eclipse.jdt.core is guaranteed to work headlessly.

  • Correction instructions for Netweaver JAVA

    Hello.
    Can someone tell me how you implement correction instructions for Netweaver JAVA modules, here portal-apps (mss) ?
    Or at least put me on the right track ?
    I have a note that needs to be implemented which contains JAVA (JSP) source code, which alternatively can be implemented via SP.
    Can this be done via NW Developer Studio without NWDI ?
    I have not found any info regarding this, any help is appreaciated.
    Best Regards Gerhard Andreassen.

    check this Note 872892 - JDI NWDI Cookbook for ESS XSS

  • Please, tool for automatic java source conversion?

    Hi,
    Apart from Sun's jilkit, do you know a software a software that could take the
    first java source below as input and automatically produce:
         1) a converted java source file similar to the second file below;
         2) resource files (e.g. mess.properties, mess_es_MX.properties, mess_fr_CA.properties) .
    We know that Sun's jilkit does this but we tried it and it is buggy and
    Sun no more supports it.
    // INPUT FILE
    import java.util.*;
    public class Test
    public static void main(String args[])
    System.out.println("Hello world!");
    System.out.println("You must Walk from " + args[0] + " to " + args[1] + "Km");
    // OUTPUT FILE, we want this done automatically
    import java.util.*;
    public class Test
    public static ResourceBundle resourceBundle = ResourceBundle.getBundle("messages");
    public static void main(String args[])
    System.out.println(resourceBundle.getString("Hello world!"));
    System.out.println(
    java.text.MessageFormat.format(
    resourceBundle.getString("Walk from {0} to {1}Km"),
    new String[]{"" + args[0], "" + args[1]}
    }

    The javadoc tool has no such capability. I believe some IDEs have
    this, but don't know which ones. You could also look at these places:
    http://java.sun.com/j2se/javadoc/faq/#docletsfromthirdparties
    http://doclet.com
    If you find a good tool, you might mention it here for others.
    cheers,
    -Doug

  • Error while compiling the ejb java source files.................

    hi,
    i am new to ejb.......
    i have got error while compiling the ejb java source files............
    while compiling..........of this three i ahve got err in ejb home interface....
    ejb remote interface - succeded
    ejb bean class - succeded
    ejb home interface - error
    the error..............is in the return type of the ejb create() method in ejb home interface(which is the type of remote interface).
    the error message is cannot resolve symbol

    Hi,
    thanks for ur reply .....
    i have done enough searching in all sites including sun forum but in vain
    i have pasted my error below...
    can u plz predict anything from it
    D:\>path=%path%;c:\j2sdk1.4.2_12\bin;
    D:\>set classpath=%classpath%;d:\Sun\AppServer\lib\j2ee.jar;
    D:\>javac d:\Librarys\Library.java
    D:\>javac d:\Librarys\LibraryBean.java
    D:\>javac d:\Librarys\LibraryHome.java
    d:\Librarys\LibraryHome.java:8: cannot resolve symbol
    symbol : class Library
    location: interface Librarys.LibraryHome
    public Library create(String id, String name, String address, String phoneNo
    ) throws RemoteException, CreateException;
    ^
    d:\Librarys\LibraryHome.java:9: cannot resolve symbol
    symbol : class Library
    location: interface Librarys.LibraryHome
    public Library findByPrimaryKey(String id) throws FinderException, RemoteExc
    eption;
    ^
    2 errors
    thanks in advance...

  • Getting all the members (variables, methods AND method bodies) of a java source file

    For a project I want to programmatically get access to the members of java source file (member variables, methods etc) as well as to the source code of those members. My question is what is the best method for this? So far I have found the following methods:
    Use AST's provided by the Java Source API and Java Tree API, as discussed in the following posts:
    http://today.java.net/pub/a/today/2008/04/10/source-code-analysis-using-java-6-compiler-apis.html
    http://weblogs.java.net/blog/timboudreau/archive/2008/02/see_java_code_t.html
    http://netbeans.dzone.com/announcements/new-class-visualization-module
    This has the disadvantage that the classes actually have to be compilable. When I look at the Netbeans Navigator view however, it provides me with a nicely formatted UI list, regardless of the "compilable" state of the class.
    Thus I started looking at how to do this... The answer appears to be through the use of tools such as JavaCC: https://javacc.dev.java.net/
    ANTLR: http://www.antlr.org/
    which are lexers and parsers of source code. However, since the Navigator panel already does this, couldn't I use part of this code to get me the list of variables and methods in a source file? Does the Navigator API help in this regard?
    Another route seems to be through tools such as
    BeautyJ: http://beautyj.berlios.de/
    which run on top of JavaCC if I am correct, and which has the ability to provide a clean view on your java code (or an XML view). However, BeautyJ does not seem to be too actively developed, and is only j2se1.4 compatible.
    I hope someone can shed a light on the best way to go about what I want to achieve. Somebody already doing this?
    (I crossposted on the Netbeans forums too, hope this is OK...)

    I'm currently developing a LaTeX editor(MDI) and I do the same thing, but I don't know what exactly do you need.

  • How can I share a *.java source file across multiple projects in NetBeans?

    I'm sure this simple and a pretty common operation but how can I share a *.java source file across multiple projects in NetBeans? Right now I keep cut, coping and pasting the same source file between multiple projects to re-use the same code. But I could I make this source file a library file or something like that so that I could access it from any project. I assume this would be a generic operation but I mentioned NetBeans for clarity. Thanks.

    fiebigc wrote:
    I know I mentioned NetBeans but I'm most interested in the generic method for creating a library of source files that I can call into whatever program I am developing. I've done such a thing in C using header files and such but I'm trying to get a direction on how this is accomplished in Java. I'm sorry if I could edit the title I would. If anyone wants to be specific about NetBeans I welcome that too.
    Edited by: fiebigc on Jun 20, 2008 5:57 PM
    >I know I mentioned NetBeans but I'm most interested in the generic method for creating a library of source files that I can call into whatever program I am developing. I've done such a thing in C using header files and such but I'm trying to get a direction on how this is accomplished in Java. I'm sorry if I could edit the title I would. If anyone wants to be specific about NetBeans I welcome that too.
    Edited by: fiebigc on Jun 20, 2008 5:57 PM
    Create a class library.
    Write your code, compile it to .class files, put those class files in a .jar file and include the jar file in the classpath whenever you want to compile a project against it.

  • Forte compile error java source files must have a .java suffix

    Hello Guru's,
    I am using Forte for Java release 2.0 build 1160, and Java SDK 1.3.1.
    When I try to compile a project in Forte I get the following error :
    "fastjavac: java source files must have a .java suffix C:\Program"
    I have looked at the source files and they do hav .java suffix!
    If this is not the correct form can someone point me in the right direction. If this is a correct forum then help is very much appreciated.
    Cheers...Harki

    Hi,
    Try to compile like this:
    javac yourfile.java
    Hope this helps you.
    Cheers.....Dinesh

  • More than one class in single java source file?

    Is there a way to define more than one class in single java source file?
    I get a duplicate class definition error for each extra class, but I am sure there is a way to handle this in JDeveloper.
    Anyone knows how ?

    Please post the question in jdeveloper forum at
    JDeveloper and ADF
    for quick response.
    Regards,
    Anupama
    http://otn.oracle.com/sample_code/content.html

  • Parser converting java source file

    I want to build a parser, which reads a java source and adds stubs at the start and end of a method, which might be for a public/protected/private method.
    This public/protected/private keyowrd , and source file will be passed as command line arguments to the parser.
    The generated output java source file should be similar to input source file with stubs.
    For example , we have a java source file( A.java) file as specified below
    class A{
         public m1(int m1_a, int m1_b){  }
         protected m2(int m2_x, int m2_y){ }
         private m3(int m3_p, int m3_q) {  }
    parser public A.java;
    after parsing it should generate output source file as A.JAVA as specified below
    class A{
         public m1(int m1_a, int m1_b)
    {  System.out.println(" start of "A:m1"" +  time: +"parameters:" +" a="+a ," b="+b)
         System.out.println(" End of "A:m1"" + time: +"parameters:" +" a="+a ," b="+b)
         protected m2(int m2_x, int m2_y){ }
         private m3(int m3_p, int m3_q) {  }
    Are there any tools , example programs , tips on the above problem .
    Anticipating help at the earliest

    HI dcminter,
    I am not talking about performance tuning,
    I need to build a program ( tool) which add System.out.println() statements as specified above for specific methods ( which might be public/private/protected ) which will be passed to the parser along with the java source text file.
    This program(tool)should only convert from one java source text file (A.java) to another java source text (A.JAVA) file , by adding the extra System.out.println() statements.
    Please help in this regard about any sample or tool or tips in solving.
    Awaiting for ur reply
    --gvr123                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Translate java source file

    Dear Friends,
    Does anybody know how to translate java sources file and get all the info from it.
    Like i want to write a parser and want to extract its details and store in datastructures.
    Any similar examples present or any suggessions please inform.
    Thanks in advance.

    there is a tool called javacc which generates parsing code. You can also google for "javacc grammar repository" to find a java grammer you can pick up and start using

  • Encoding of java source files

    I've sucesfully compiled java source files (*.java files) over a lot of different encodings (ANSI, Unicode, UTF8, etc). My IDE (Eclipse) has Cp1252 as default on WIndows OS.
    There is an 'official' encoding for source files ?

    Short answer is Unicode -but that's not enough.
    From Java Language Specification:
    "Except for comments (�3.7), identifiers, and the contents of character and string literals (�3.10.4, �3.10.5), all input elements (�3.5) in a program are formed only from ASCII characters (or Unicode escapes (�3.3) which result in ASCII characters). ASCII (ANSI X3.4) is the American Standard Code for Information Interchange. The first 128 characters of the Unicode character encoding are the ASCII characters."
    There's more that applies, I'll not quote it, read chapter 3 of JLS for details.
    http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html

  • Do we have to separate java source files and class files after compiled..

    Hi,
    I really confussed with this:
    I have compiled java source files into a package and tried to use but the classes can not be found. Should I separate class and source files after compiled with packages names. I hope you understand what i mean.
    Thank you
    So Jag

    You can choose to separate the source files or not. It sounds like your problem has to do with Classpath and packages.
    If the file c:\base\compute\engine\mysourcefile.java starts with the statement "package engine;" then the fully qualified name of the class is is engine.mysourcefile. If the file c:\base\compute\client\mysourcefile.java starts with the statement "package client;" then its fully qualified name is client.mysourcefile.
    In your source files, whenever you refer to a class from another class, the compiler needs the fully qualified class name. You can either import the class or use the fully qualified name. In order for the compiler to find the class, the c:\base\compute directory must be in the Classpath (assuming the package definitions from above).
    Finally, to launch an application given the above, the command would be "java client.mysourcefile" assuming the main method is in client.mysourcefile.

  • How to debug byteCode? Can cap file convert to java source file?

    Are there tools can debug byteCode?
    Are there tools can convert cap file to java source file?
    Are there tools can convert jca file to java soure file?

    I think it's little bit difficult to give you a correct answer. Frankly speaking, cap file debugging is possible if you have sufficient devices and knowledge to do that. Converting cap file to java source code is also possible only if the cap file has descriptor component in it. Names of variables, functions will not be completely restored because cap file doesn't have the names in it. But I am not sure that there is a publicly opened tool to do that. JCVM chapter 6 may show you the way even it's not the direct one.

  • Parsing java source files - identifying method signature

    Im doing a project in which i need to parse java source file and identifying java method signature to take the methods parameters name as tokens, does anyone know how to do this with regular expression? I really appreciate your help.
    regards,
    gr33nl1nk

    i'm still working on it, but still doesn't work :'(
    // Regular expression used to find the result type and the name of a method
    //String s1 = "\\s-*\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-+\\)*\\(.*\\)";
    String s1 = "\\s-*((public|protected|private|const|abstract|synchronized|final|static|threadsafe|transient|native|volatile)\\s-+)*\\(.*\\)";
    // Regular expression used to find the method arguments
    String s2 = "([ ]*\\(.*\\)[ ]*)";
    // Regular expression used to find the method exceptions.
    String s3 = "throws[ ]+\\(.*\\)[ ]*[{;]";
    // Regular expression for white spaces separator
    String sp = "[ \t\r\n]+";
    //String mspat = s1+sp+s2;
    String mspat = s1;
    compile(mspat);

Maybe you are looking for

  • How to make one Mac the "master", and the other Macs "secondary"?

    When using ISync to my DotMac account, and using three or four Macs all synching to one DotMac account, is it possible to designate one particular Mac to be the "most important" or "parent" Mac, and then all others, (laptops), be less important? I ju

  • Remove Empty XML Tags using module parameters

    Hi All, In my lanscape I have two PI Systems. My scenario is an IDOC reaches 1st PI system gets converted into an EDIFACT and then goes to the 2nd PI and from there it gets routed to the respective AS2 Party. I am using SOAP to pass message between t

  • Cannot identify lock screen icon on Lumia 520

    There is an icon at bottom of my lock screen that I can't find an explanation for. It appears to be a square with a circle inside, with the typical email envelope icon coming out to its right, and the number 2 to right of both of those. I have no unr

  • Class object

    Hi, I have a question about the class Class. Assume that I have written a program containing 3 classes (say 1.java, 2.java, 3.java). Now, when the program is compiled, we get 3 classes namely 1.class, 2.class and 3.class. Are these the classes that a

  • Report RFFOAVIS_FPAYM with E-Mail -- Error SO619

    Hello, we are sendung SEPA prenotifications to customers during using payment run with transaction F110. Here we are creating output messages (email) with report RFFOAVIS_FPAYM. Printer is MAIL. Sometimes we are getting error messages that some messa