I cannot break my java source into packages

I would like to convert my java source in my Creator project(s) to standard package naming conventions such as com.mycompany.myapp but I'm having difficulty. After renaming the package within the Java Sources folder, and making necessary related corrections in referencing Java source files and managed-beans.xml I still cannot get the application to run. The IDE is also losing the ability to render the JSP source as well due to a broken binding reference that is not kept in sync. In general is it possible to use packages in Creator where the java source files are in sub-directory packages? I happen to be using Windows 2000. But I can use other operating systems if it will work elsewhere.

Hello Iwan.
Unfortunately, I was not able to find a clean workaround for implementing a multi-level package structure on an "existing" application.
I WAS able to do it eventually knowing the desired tree structure I needed to reach (as already noted), but it required a lot of hand editing as Creator appropriately cautions.
I even had to get into the private "project.prj" file eventually outside of creator in notepad to clean up my structure before I could finish.
Anyway, I want to repost my prior instructions for implementing package structures on NEW projects.
I found an error in yesterday's post and some misplaced words. This is a corrected version.
Also, this approach was not tested exhaustively - but I think it is probably close.
Again my environment happens to be running on Windows 2000.
Updated/corrected notes for building a new "packaged" Creator application.
=====================================================================
It turns out you can avoid manual editing if you follow this sequence for new applications.
It is helpful to understand these concepts that steer our procedure:
1) The "Web Pages" directory and "Java Sources" directory require synchronized directory trees to accomodate the mirror relationship between packaged *****.jsp and *****.java bean backing files.
2) The "Web pages" directory tree will not display the highest-level node - it apparently shares/references the highest-level package node immediately under the Java Sources folder.
You will need to substitute your own names for package nodes as desired.
This example develops the package named "com.company.division.mypackage".
As such my project directory tree goal is:
Project Navigator (Logical View)
=========================
MyProject
-- Web Pages
---- Resources (ignore for this exercise)
---- company
------ division
-------- webapplication1
---------- Page1.jsp
-- Page Navigation (ignore for this exercise)
-- Managed Beans (ignore for this exercise)
-- Java Sources
---- com
------ company
-------- division
---------- webapplication1
------------ ApplicationBean1.java
------------ Page1.java
------------ SessionBean1.java
+ Library References (ignore for this exercise)
+ Data Source References (ignore for this exercise)
Steps to repackage your application without manual editing:
==========================================================
1) Create a new default application - in our case my case named WebApplication1:
Use any method you want to create a new project accepting all default naming.
You will get a project with 3 java beans (Application, Session, and Page) and Page1.jsp.
I had confusion because of names similar to WebApplication1 used for the Project, Context, Package, and Application.
The following two options decouple two of these names - that may or may not be helpful for you.
Optional: Rename project WebApplication1 to MyProject to avoid naming extension confusion:
Select the top/main folder in the Project Navigator and right click for context menu options
Select the Rename Project option, enter your desired name, and click OK
Please allow several seconds for the project refactoring to rebuild your directories
Optional: Rename project context from webapplication1 to URL context name appropriate for you:
Select the top/main folder in Project Navigator (Just named MyProject in the preceding example)
Enter your desired URL Context Path in the Properties window field and press Enter.
2) Delete the Page1.jsp file and Page1.java file as follows:
Select the Page1.jsp or Page1.java file
Right click for a context menu and select the delete option
Accept/Acknowledge deletion of the synchronized counterpart bean/jsp
3) Build your new Web Pages directory tree as shown above without a "com" folder:
Use either the context menu "New > Folder" or "New > Package" option - they both work
As shown we need to create a 3 level sub-folder: company, then division, then webapplication1
4) Build your new Java Sources directory tree starting by renaming your package root:
In the Java Sources folder rename "WebApplication1" package to "com".
This is accomplished within the context menu accessed via right-click on your mouse.
Enter "com", press Ok, and then accept "Yes" to rename all package declaration references.
Enter "Ok" to acknowledge the need for warning about manual editing being necessary.
Use the context menu "New > Folder" or "New > Package" option - they both work
to create / add the remaining sub-directory folders within the newly named "com" folder.
As shown this is 3 more sub-folders: "company", then "division", then "webapplication1".
5) Copy your Application Bean java file then delete it from the source:
Right-click on your ApplicationBean1 file and select copy.
Select (left-click) the target Java Sources > com > company > division > webapplication1
folder and paste the file copy (Ctrl-v).
Now delete the original application bean source in the "com" folder with the delete key.
6) Copy your Session Bean java file then delete it from the source:
Right-click on your SessionBean1 file and select copy.
Select (left-click) the target Java Sources > com > company > division > webapplication1
and paste the file copy (Ctrl-v).
Now delete the original SessionBean1 source in the "com" folder with the delete key.
6) Recreate your request Web Pages folder Page1.jsp - the java bean will be echoed:
Left-click (select) the folder: Web Pages > company > division > webapplication1.
Right-click for a context menu and select New > Page and type "Page1" and press Enter.
You should see a new Page1.jsp file in Web Pages > company > division > webapplication1.
You should see a new Page1.java file in Java Sources > com > company > division > webapplication1.
You're ready to create code within your company's packaging structure!
Regards,
Craig Hunt

Similar Messages

  • Break a java source file

    Hi all,
    I'm working in a project which require me to break a .java program into several tokens, such as classes, interface, instant variable or instand method.
    Thx

    Hi,
    Thats nice to know.
    Do you have a question or were you just letting us know what you are up to?

  • Splitting Java source into multiple WSDLs using ANT

    Hi,
    I have seven of webservice operations defined in a single webservice class. But, I want those split into different WSDLs as different services (with different service names) using ANT. I cannot find a easy way of doing that.
    The problem is that when I use servicegen, I can give the same webservice class as different services which would split it into different services. But, I would have all the operations in the overall webservice into every single service. That is not acceptable. Each service can have only one operation.
    Is this possible at all? I am using WLS 813?
    Thanks,
    Sridhar

    If you are asking if there a way to tell servicegen to put different operations from the same Java source in different WSDL, the answer is no.
    You can use the source2wsdd Ant task (http://edocs.bea.com/wls/docs81/webserv/wlws_tags.html#1095437) and the @wlws:exclude tag to exclude methods from the WSDL, but that's about it. Here, you would have multiple copies of the Java source, with each having the @wlws:exclude tag on all but one method. The names of these file copies would be something like <real-file>1.java, <real-file>2.java, etc. You won't ever compile these files, you'll just us them to copy over <real-file>.java, before you run source2wsdd. You'll be running source2wsdd on xxx.java, as many times as you have <real-file>n.java files.
    source2wsdd will then produce a seperate web-services.xml (i.e. web service) for each copy over of <real-file>.java. Each of these web services will need to have a different context root, because the endpoint for a WLS web service is exposed as a servlet.
    HTH,
    Mike Wooten

  • JDI: Cannot EDIT a java source file in a loaded, inactive DC

    I have finished JDI Scenario 2+.  I have since built a new workspace and imported my Development Configuration.  I would now like to edit the java code and do a re-deployment.
    Problem: I cannot Edit the file; it is read-only.  I was able to edit the file from a different workspace yesterday, at which time when I typed in the editor I was prompted to create and activity and I did.  I did NOT mark it for exclusive check-out.
    Since then I have done a REVERT on that activity,but I still cannot edit this file in my second new wrokspace.  In the context menus, in the DTR sub-menu, the EDIT selections are always grayed-out.
    So, can someone advise how I can get the EDIT selections to be not grayed-out so that I can edit this file in the Java editor?
    Thanks,
    Mike R.

    Hi Mike,
    You are right, and the instructions are wrong: the "Create Project" must be done from the "Inactive DCs" view (for the sources to be editable).
    The "Active DCs" view will give you sources from the "active" workspace (containing all "activated" sources), which is read-only. For DCs you work on (and modify), you should sync sources from the "Inactive DCs" view, and for DCs you depend on you should sync archives/sources from the "Active DCs" view.
    I have requested for a correction of this error in our documentation.
    Regards,
    Manohar
    PS: There is now a dedicated SDN forum for JDI (under WebAS) - so you can post your questions there in future.

  • Error in compiling java source code in a package

    hi all...
    am having a problem in compiling a java source code:
    i have a class named 'Test' in the package 'packone'....
    i have another class named 'getTest' in the same package....
    in the class getTest i am taking a reference to Test class...
    on compiling i am getting the following error....
    cannot resolve symbol
    symbol : class Test
    The source code for the two classes are :
    package packone;
    public class Test{
    and
    package packone;
    public class getTest{
    public void me(){
         Test t = new Test();
    i have included the directory path in the classpath....
    still its not compiling .....
    please help
    thanks....

    Assume the current directory structure:
    C:\
    C:\packone...and that your classes are named Test & GetTest.
    My guess is that you're compiling within the directory C:\packone using the command "javac GetTest.java", which is wrong; You must use a path corresponding to the package-name.
    Move your command-line cursor to C:\ and type "javac packone\GetTest.java" and you'll be fine...
    Regards,
      /H&aring;kan

  • 'Cannot find symbol' error after putting class into package

    I'm sure this is probably just a stupid mistake that I am making somewhere, but I can't figure it out.
    I have written a Java program, "LineConsole.java" and an interface, "LineConsoleKeyListener.java". LineConsole.java uses the interface (it does not implement it... it uses LineConsoleKeyListener objects in the program). If I put the two .java files into the same directory and compile them, everything works.
    So now I want to put them in a package called "LineConsole". I thought all I had to do was move the two files into a folder called "LineConsole" and add "package LineConsole;" to the top of each file. I did that, but now LineConsole.java does not compile. It complains that it cannot find the LineConsoleKeyListener interface, even though it's right there in the same directory.
    What am I doing wrong? Do members of a package have to import themselves or something?
    Thanks!
    Message was edited by:
    L4E_WakaMol-King

    Thanks guys :)
    It's working now.
    One more question...
    Right now I have 3 files in a folder names "LineCon":
    - LineConsole.class
    - LineConsoleKeyListener.class
    - wincbreak.dll
    If I copy that directory into the same directory as some other program I am writing, I can use those classes just like they are in a package. But is there any way to zip that package into a jar file? I know how to create jar files, but is there a way to make them behave like packages?
    I have tried creating a jar file with the individual files and also with all three files in a directory. The jar file is created successfully, but I cannot copy that jar file into the directory of a program and use the classes within it as if they were a package.
    I guess my ultimate question here is... how do I import a .class file that is in a jar file?

  • Cannot find Java Source Objects

    How do I view the java source code in my own account. I dont see it anywhere in the object tree? However, when I do use the report tool and seach the source I can view it.
    Shouldn't I be able to see java code just like I can see PL/SQL code... eh? bug? operator error? :)
    Thanks..
    Message was edited by:
    Mark Reichman

    Uh, but if I have 20 or 30 Java objects in my account I would at least like to see them?
    I just saw this statement on the SQL Developer Statement of Direction page.
    JDeveloper and SQL Developer
    The plan is to incorporate the functionality in SQL Developer into a future release of JDeveloper.
    Seems as though Oracle should have just added this 'SQL Developer" functionality to JDeveloper to begin with and not even had this separate "SQL Developer" tool. I always thought JDeveloper lacked some these SQL Developer features anyway. Doesnt JDeveloper allow me to edit PL/SQL? Yes. Whats the problem with SQL Developer allowing me to edit Java? We have a lot of java and plsql in our schemas and having separate tools doesnt really make sense to me? And I hate to say it but other tools like SQL Developer let me view and edit my java objects. This is not going to go over well here at all and may prevent migration away form other SQL Developer like tools. Its almost like SQL Developer is half a tool then since I can only see "most" of my DB objects?
    One of the nice things about SQL Developer is that it is light weight and easy to learn as compared to JDeveloper. IMHO...
    Is this true or are Java objects being added in 1.1 to the tree? Now I'm bummed. Tell me it isnt so. :)
    Message was edited by:
    Mark Reichman

  • JavaService - can install java program into win2k service, but cannot run

    i have a JavaService problem: i can install java program into win2k service, but cannot run
    the version of javaservice is 2.0.7.0
    the following is the message:
    C:\DailyUpdate\dist>JavaService.exe -install DailyUpdate C:\Program Files\Java\j
    dk1.5.0_05\jre\bin\client\jvm.dll -Djava.class.path=C:\DailyUpdate\dist\ftpbean.
    jar;C:\DailyUpdate\dist\mysql-connector-java-3.0.10-stable-bin.jar;C:\DailyUpdat
    e\dist\DailyUpdater.jar -Xms16M -Xmx64M -start DailyUpdateHandler -params C:\Dai
    lyUpdate\dist -out C:\DailyUpdate\dist\logs\out.log -err C:\DailyUpdate\dist\lo
    gs\err.log
    The DailyUpdate automatic service was successfully installed
    The DailyUpdate service is starting.
    The DailyUpdate service could not be started.
    The service did not report an error.
    More help is available by typing NET HELPMSG 3534.

    I might be doing some programming for my company soon
    which will require a program to monitor a database
    and whenever there is a change to certain fields, it
    must copy certain fields into another database. When I see "whenever thiere is a change to certain fields" I tend to think "triggers" - but maybe this won't work for you 'cause of the "another database" part. And the fact that triggers are inherently evil.
    [snip]
    Is it possible to run a Java program as a windows
    service? And if so then how would you go about it? I'd hit Google - there're a couple ways to do this.
    [snip]
    Also,...if I were to use one of those programs which
    can make an .exe of a Java program, then do you still
    require the JRE to be on the machine? It depends on how you did the conversion. If you compile to native then no, if you just wrap up a JRE then yes.
    Why I ask is
    that I occasionally get asked to do small development
    projects for my company, but we are a microsoft
    partner and therefore do all the development in C#
    and the like. So I would like to just implement as
    many things in Java as I can, just to show everyone
    that Java can do exactly what C# can do. But its
    difficult to convince people of this since I always
    require the JRE and they dont. Of course, they require the .NET framework and you don't. And last I looked that thing was around 23 Meg.

  • Converting class files into java source codes

    Dear Friends,
    It is true that conversion of class files to its java source codes is possible through some software. I want to know, is there any way to protect my java source codes from viewing or copying illegally by other persons ?
    If I create JAR file from java files, can it be also convertible back to source codes ?
    Avi

    You can use code obfuscators in order to protect your code. And yes a jar file can also be decompiled.
    http://www.retrologic.com/
    http://www.2lkit.com/products/2LKitObf/
    http://www.codingart.com/codeshield.html
    http://www.drjava.de/obfuscator/

  • How to compress a bunch of .java files into a single .jar file?

    Hello everyone! I am working on a Chinese segmentation job. Someone offers very excellent
    such tool. When I copy his example, I find it imports
              import org.apache.lucene.analysis.Analyzer;
              import org.apache.lucene.analysis.Token;
              import org.apache.lucene.analysis.TokenStream;
              import org.mira.lucene.analysis.IK_CAnalyzer;I have downloaded IK_CAnalyzer.jar file which contains org.mira.lucene.analysis.IK_CAnalyzer class.
    I find that I need to download lucene, thus I went into the following website
    http://lucene.apache.org/#06+May+2008+-+Lucene+Java+2.3.2+availableand downloaded the lucene-2.3.2-src.tar.gz. Aftre unzip, I found all java source files in java directory (and in many other different subdirectories). Now it seems I need to compile all the src files and compress them into a single .jar file while keeping their original hierarchy unchanged
    I think I should use jar command and with some additional options.
    Can anyone show me how to do that?
    Many thanks!
    Edited by: aaron9979215 on Jul 12, 2008 5:17 AM

    Thanks for reply, I?ve read that tutorial before I post. Howevver, it do tells how to compress a jar file.
    The question I have is how to compile two .java file stored in different packages like
    rootPackage-->subPackage-->a.java
    rootPackage-->subPackage2-->b.java
    I want to compile a,java and b.java both and keep their hierarchy like rootPackage.subPackage.a unchanged. If I directly go into subPackage and compile a.java, I think the hierarchy is changed.
    What do you think about it?

  • Problem with creating JAVA Source. please help

    Dear all
    how are you.
    In fact I have made a simple java class that return a string which represents the screen size . for example 800/600 or 1024/768 or others
    but I face error ORA-29541 class string.string could not be resolved
    This what i made
    first i created my JAVA Source
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "ScreenProperty" AS
    import java.lang.Object;
    import java.awt.*;
    public class ScreenProperty
    int w;
    int h;
    public static String getScreenSize()
    w = Toolkit.getDefaultToolkit().getScreenSize().width;
    h = Toolkit.getDefaultToolkit().getScreenSize().height;
    return w+"/"+h;
    SQL>Operation 160 succeeded.
    this means the the java source created successfuly
    and I'm sure that my java code is correct
    then i created a fuction to call this java source as fellow
    SQL> create or replace function f_get_screen_size
    return varchar2
    as language java
    name 'ScreenProperty.getScreenSize() return java.lang.String';
    Function created.
    the I Issued this sql statement to return the result that should be varchar2 that represent the sceen size(1024/768)
    SQL> select f_get_screen_size from dual;
    ORA-29541 class string.string could not be resolved.
    I do not know what is the reason for this error
    and when i searched the documentation for this error i found
    ORA-29541 class string.string could not be resolved
    Cause: An attempt was made to execute a method in a Java class that had not been previously and cannot now be compiled or resolved successfully.
    Action: Adjust the call or make the class resolvable
    I need to know what is the problem.
    And is there another way to load this class other than making JAVA SOURCE
    please help

    before drawing hands of clock you could fill a circle/oval with certain color, then you'd have that kind of circle that has been filled as backgound.
    you may change those dots to be small lines for 12, 3, 6 and 6 o'clock and then have small dots represent 1, 2, 4, 5, 7, 8, 10 and 11 o'clock
    anyhow, you should study that code and see how you can modify it whitout breaking it but having it look different.
    better yet would be trying to understand how it works, what any line there means and then recreate your own... this way you would learn more....
    and if there are some methods or anything you don't understand, then look them up from API documentation
    good luck.

  • Abount java source file name

    Friends,
    I am new in java... Kindly clarify my doubt...
    when i create public class i have to give the class name as my file name. but if i create a default class
    like
    class SimpleClass
    i need not give the exact class name as file name.
    why?
    sorry for my english...

    Java source code files may contain one and only one top-level (that is, non-nested) public class declaration. The name of the public class must match the source file name.
    The java language specification details this here:
    http://java.sun.com/docs/books/jls/third_edition/html/packages.html#26783
    Obviously if you were permitted more than one top-level class per compilation unit then I suspect you would into problems with access privileges.

  • 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.

  • 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

  • Java source and class locked, unable to drop or replace

    Because Oracle 9i does not come with an FTP implementation, I installed the apache.commons.net package into the database, and implemented static java wrappers to allow me to publish the code.
    After thoroughly testing the code under JDeveloper, I deployed the code to the database.
    The code hung, establising a lock on one or more classes. Besides not knowing how to debug and java packages inside the Oracle database (eg, why did the code fail in the first place?), I have no idea how to unlock the source or class of my java objects.
    How does one find what process is locking the java source and/oir class?

    Try something like:
    select s.username, pr.pid, pr.spid from
    x$kglpn p, x$kglob o, v$process pr, v$session s
    where p.kglpnhdl = o.kglhdadr
    and pr.addr = s.paddr
    and p.kglpnuse = s.saddr
    and o.kglnaobj = dbms_java.shortname('fully/qualified/ClassName');

Maybe you are looking for

  • Power View in SharePoint Server - The data extension type for a data source is not valid

    Hi All, All of a sudden I am getting following error when trying to create Power View report using shared report data source (no error testing the connection): "The current action cannot be completed. The data extension type for a data source 'http:/

  • Imovie09 Burning to DVD from HD project file

    I have just burnt a HD edited imovie project file to a DVD using the 'large settings' in IDVD after exporting to media browser. The results when played on a DVD player are extremely low quality. There appears to be a considerable patterning affect on

  • Auto log in from applet to web app.

    I'm trying to allow a user to jump from an applet to a web app. The applet code I'm pretty sure is complete. It creates a URL and then calls container().getAppletContext().showDocument(new URL(path),name); This opens a browser and seems to be sending

  • Known issue..?  dot notation in XSD..

    I have an HL7 exported schema.. very large 1.5 MB In my sample payload I have good data: <receiveInput_Read_Input> <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ADT_A01"> <ADT_A01 xmlns="http://www.edifecs.com/xdata/200" xmlns:xsi

  • How to run another concurrent from Java Concurrent Program?

    Hi, I have one Java Concurrent Program in ebs R12. I need to run another Java Concurrent Program when first finished. I can not find a way to start another request from JCP. Thanks, ms