Using Java 6 classes with Java 5
I ran into a little problem with the portability of Java (ironic eh?) across computers. The program I wrote on my home computer uses GroupLayout for the GUI. However, much to my surprise, the computers at my school only had Java 5 installed so the program could not run (GroupLayout is a class found only in Java 6). Is there any way to somehow package the GroupLayout class into my program?
C_Zhao wrote:
I ran into a little problem with the portability of Java (ironic eh?) across computers.Not as ironic as you might think.
The program I wrote on my home computer uses GroupLayout for the GUI. However, much to my surprise, the computers at my school only had Java 5 installed so the program could not run (GroupLayout is a class found only in Java 6). Is there any way to somehow package the GroupLayout class into my program?Technically, yes, but I'd imagine that rewriting your code to use a different layout manager (such as one of those available in J2SE 5) would be quicker / easier. In fact, I'm almost willing to guarantee that refactoring would be easier than repackaging.
Similar Messages
-
How to display value from java class with output generated with toplink
i hava a requirement of displaying (distance ie calculated in java class) with output generated by query.
ie if output is like
school name (distance)
physical address
here the school name and physical address are retrived from database.Hi,
ValueHolders are used by the JSF internal framework. To work with an object (attributes) in a managed bean you don't need to make it returning a value holder.
Create a POJO, provide accessor methods and register it as a managed bean. Access it from JSF with EL
Frank -
Using Berkeley Java Edition with Java Web Start
Hi
Have anyone had any experience using Berkeley Java Edition with Java Web Start?. I need to create an application that will download with the database to a client computer and create the database thereThanks for your reply Luca-Sanna,
This is my jnlp file
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/dist" href="launch.jnlp">
<information>
<title>MyApplication</title>
<vendor>My Company</vendor>
<homepage href="/test.html"/>
<description>My Test Application</description>
<description kind="short">My Application</description>
<icon href="test.gif" kind="default"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="myapp.jar" main="true" download="eager"/>
<jar href="lib/appframework-1.0.3.jar" download="eager"/>
<jar href="lib/beansbinding-1.2.1.jar" download="eager"/>
<jar href="lib/commons-beanutils.jar" download="eager"/>
<jar href="lib/commons-collections.jar" download="eager"/>
<jar href="lib/commons-digester.jar" download="eager"/>
<jar href="lib/commons-logging.jar" download="eager"/>
<jar href="lib/derby.jar" download="eager"/>
<jar href="lib/derbyclient.jar" download="eager"/>
<jar href="lib/derbynet.jar" download="eager"/>
<jar href="lib/itext-1.3.1.jar" download="eager"/>
<jar href="lib/jasperreports-1.3.0.jar" download="eager"/>
<jar href="lib/jbossall-client-2004-05-11.jar" download="eager"/>
<jar href="lib/jdt-compiler-3.1.1.jar" download="eager"/>
<jar href="lib/poi-2.0-final-20040126.jar" download="eager"/>
<jar href="lib/swing-worker-1.1.jar" download="eager"/>
<jar href="lib/toplink-essentials-agent.jar" download="eager"/>
<jar href="lib/toplink-essentials.jar" download="eager"/>
</resources>
<application-desc main-class="mypackage.Login">
</application-desc>
</jnlp>
I have seen many forums with the same above problem with no reply.
Anyone knows what exactly the problem is? -
How to use MyFaces component with Java Creator 2
Please advise for me the way to use Myfaces component with Java Creator 2. Thanks
Apologies for the late reply, but currently what exists generally for MyFaces integration with Creator is on this blog:
http://wiki.java.net/bin/view/Javatools/CustomComponentLibraries
You might also want to post the same question on the nbusers alias on netbeans.org, referencing Visual Web Pack
Regards,
-Brad Mayer -
Only to import JAVA CLASS and JAVA SOURCE from .DMP file using IMPDP
hi,
I have a schema X, In that schema some of the *"JAVA CLASS" and "JAVA SOURCE"* objects are missing ..
The procedures ,functions..etc objects were updated at X schema..
I have 1 dmp file of Y schema , containing the missing "JAVA CLASS" and "JAVA SOURCE" s.. Can I import the the same to the schema X using IMPDP
i tried using INCLUDE clause but it is not working
eg:
impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA CLASS","JAVA CLASS"but error..
ORA-39001: invalid argument value
ORA-39041: Filter "INCLUDE" either identifies all object types or no object types.regards,
jpDouble post: IMPDP to import JAVA CLASS and JAVA SOURCE from .DMP file
Already replied.
Regards
Gokhan -
Most commenly used abstract class in java.
hi all,
can anyone please tell me, what is most commonly used abstract class in java. this question was asked in interview.I hate interviewers when they ask about specifics of some classes.The fact that you hate it doesn't automatically follow that it's a bad question from the perspective of the person conducting the interviewer. You don't know what the real question is.
Bad "real" question: Do you know the statistics of Java usage off the top of your head?
Good "real" question: Do you know that Object isn't Abstract and can you name a few Abstract classes off the cuff?
Even then Programmers are so literal minded - the real question may be "Talk about what you know a bit." -
Drop java class and java source
Hi,
When I query user_objects I get some java class and java source objects
select * from user_objects where object_type like 'JAVA %';
How do I drop these java source and java class objects from the database
I tried using the following command
drop java class /4a524d89_AutoTransliteratorPk
drop java source AutoTransliteratorPkg
But I get error ORA-29501: invalid or missing Java source, class, or resource name
Please someone help me in dropping these objects
thanks
saazwas the java source all caps or was it exactly AutoTransliteratorPkg. If its exactly AutoTransliteratorPkg then try this
drop java source "AutoTransliteratorPkg" -
IMPDP to import JAVA CLASS and JAVA SOURCE from .DMP file
hi,
I have a schema X, In that schema some of the *"JAVA CLASS" and "JAVA SOURCE"* objects are missing ..
The procedures ,functions..etc objects were updated at X schema..
I have 1 dmp file of Y schema , containing the missing "JAVA CLASS" and "JAVA SOURCE" s.. Can I import the the same to the schema X using IMPDP
i tried using INCLUDE clause but it is not working
eg:
impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA CLASS","JAVA CLASS"but error..
ORA-39001: invalid argument value
ORA-39041: Filter "INCLUDE" either identifies all object types or no object types.regards,
jpHello,
You should type JAVA_CLASS and JAVA_SOURCE (use underscore instead of space).
impdp john1/john1@me11g22 directory=datadump dumpfile=DEVF2WAR.DMP remap_schema=devf2war:john INCLUDE="JAVA_CLASS","JAVA_CLASS"Best Regards,
Gokhan Atil
If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks -
Changing Java class into Java Bean
Can anybody tell me how to change a Java class into simple Java Bean.I dont need any visual interface of Java Bean.I simply want to turn my Java class into Java Bean.
You can use almost any class as a java bean.
To be a bean it must
1 - Have a constructor which takes no arguments (so it can be instantiated)
2 - For properties/attributes which you want to have readable/writable, provide get / set methods of the appropriate type.
Thats it. -
Using java classes with Forms 6i
Hello everyone,
I want to use some Java.io functionality in Forms 6i but I'm not sure how to go about doing this. How can I access java classes from a forms application?
Thanks,
WesUse th Java Importer - information on otn.oracle.com/products/forms or in the on line help.
Regards
Grant Ronald
Forms Product Management -
Using List Class in java.awt / java.util ?
have a program that:
import java.util.*;
List list = new LinkedList();
list = new ArrayList();
... read a file and add elements to array
use a static setter
StaticGettersSetters.setArray(list);
next program:
import java.awt.*;
public static java.util.List queryArray =
StaticGettersSetters.getArray();
If I don't define queryArray with the package and class, the compiler
gives an error that the List class in java.awt is invalid for queryArray.
If I import the util package, import java.util.*; , the compiler
gives an error that the list class is ambiguous.
Question:
If you using a class that exists in multiple packages, is the above declaration of queryArray the only way to declare it ?
Just curious...
Thanks for your help,
YAM-SSMSo what you have to do is explicitly tell the compiler which one you really want by spelling out the fully-resolved class name:
import java.awt.*;
import java.sql.*;
import java.util.*;
public class ClashTest
public static void main(String [] args)
java.util.Date today = new java.util.Date();
java.util.List argsList = Arrays.asList(args);
System.out.println(today);
System.out.println(argsList);
}No problems here. - MOD -
How can I execute a java class with arguments from an air application built from mxml?
I have an mxml application. It has a button, and when that button select event occurs, I want my mxml air app to pass arguments to a java class I have built, which resides in a package path on my system. I need to be able to pass several arguments to my java method from my mxml call. How do I do this, and what config files are necessary? For the simple task I want to engineer, can you show me an example of a properly configured config file? My java class has been executed at the command line in the past as follows:
java -cp %CP% com.abc.prism.queue.EmitMessage XYZ "my message text" 192.12.13.14 5672
where %CP% is an env variable that tells my class the classpath it runs with, and XYZ, "my message text", the IP address, and the port are the arguments I must pass from mxml to my java class. How do I accomplish this?
How do I make known to the java class I call from mxml the %CP% class path? It tells my java class where to find various rabbitMQ jars.Hi,
You need to use Integration technology like BlazeDS or LCDS. -
How to use parameter file with java
Is it possible to use a parameter file with Java, and is there any class/method to make it easy to call and use these parameter from a text file, other than scanning the whole text file manually as we can do normally with visual basic/c++, so we can call the program with the parameter file, like java testing c:\\testing.ini
If I understand you correctly, you may be looking for a properties file. This is basically a text file that contains pairs of strings in the form:
parameter1=value1
parameter2=value2
parameter3=value3
...etc.
and the values are retrieved using the java.util.Properties class - see:
http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
Sample use://Call chis method once, to load the props file.
//props file is called "demo.properties", and is
//in a directory that is included in the classpath
private void loadMyProperties() throws Exception
InputStream stream = getResourceAsStream("/demo.properties");
if(stream == null)
throw new Exception("stream is null!");
demoProperties = new Properties();
demoProperties.load(stream);
stream.close();
// Then you can retrieve properties in your code using:
String param3 = demoProperties.getProperty("parameter3");
//...etc -
Using ExecutorService class from java.util.concurrent package
Dear java programmers,
I have a question regarding the ExecutorService class from java.util.concurrent package.
I want to parse hundreds of files and for this purpose I'm implementing a thread pool. The way I use the ExecutorService class is summarized below:
ExecutorService executor = Executors.newFixedThreadPool(10);
for (int i = 0; i < 1000; i++){
System.out.println("Parsing file No "+i);
executor.submit(new Dock(i));
executor.shutdown();
try {
executor.awaitTermination(30, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
ex.printStackTrace();
executor.shutdownNow();However, the code snippet above creates all the 1000 threads (Dock objects) at once and loads them to the executor, and thus I'm worrying about memory leak. I haven't tested it on 1000 files yet but just on 50 small ones, and even if the program prints out "Parsing file No "+i 50 times at once, it executes normally the threads in the background.
I guess the write way would be to keep the number of active/idle threads in the executor constant (lets say 20 if the thread pool's size is 10) and submit a new one whenever a thread has been finished or terminated. But for this to happen the program should be notified someway whenever a thread is done. Can anybody help me do that?
thanks in advance,
TomOk I found a feasible solution myself although I'm not sure if this is the optimum.
Here's what I did:
ExecutorService executor = Executors.newFixedThreadPool(10);
Future<String> future0, future1, future2, future3, future4, future5, future6, future7, future8, future9;
Future[] futureArray = {future0 = null, future1 = null, future2 = null, future3 = null, future4 = null, future5 = null,
future6 = null, future7 = null, future8 = null, future9 = null};
for (int i = 0; i < 10; i++){
futureArray[i] = executor.submit(new Dock(i));
}I created the ExecutorService object which encapsulates the thread pool and then created 10 Future objects (java.util.concurrent.Future) and added them into an Array.
For java.util.concurrent.Future and Callable Interface usage refer to:
[http://www.swingwiki.org/best:use_worker_thread_for_long_operations]
[http://www.particle.kth.se/~lindsey/JavaCourse/Book/Part1/Java/Chapter10/concurrencyTools.html]
I used a Future[] Array to make the code neater. So after that I submitted -and in this way filled up- the first 10 threads to the thread pool.
int i = 9;
while (i < 1000){
for (int j = 0; j < 10; j++){
if (futureArray[j].isDone() && i < 999){
try{
i++;
futureArray[j] = executor.submit(new Dock(i));
} catch (ExecutionException ex) {
ex.printStackTrace();
} catch (InterruptedException ex) {
ex.printStackTrace();
try {
Thread.sleep(100); // wait a while
} catch(InterruptedException iex) { /* ignore */ }
executor.shutdown();
try {
executor.awaitTermination(60, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
ex.printStackTrace();
executor.shutdownNow();
}Each of the future[0-9] objects represents a thread in the thread pool. So essentially I'm check which of these 10 threads has been finished (using the java.util.concurrent.Future.isDone() method) and if yes I replenish that empty future[0-9] object with a new one. -
How to use Xpath effectively with Java
I am using Xpath for parsing a String with following syntax.This is a string suppose String xmlShopstring.
<shopper>
<upc>0123456789</upc>
<desc>Planeters Peanutus</desc>
<regprice>1.99</regprice>
<errorcode></errorcode>
</shopper>In this case how can I use xpath parsing ?You can use classes from javax.xml, org.w3c.dom packages for performing XML operations in java.
These APIs have very rich set of classes and methods for performing XML operations effectively.
pravi.pravi wrote: how can I use xpath parsing?You need to parse XML String to org.w3c.dom.Document with use of following classes:
javax.xml.parsers.DocumentBuilderFactory
javax.xml.parsers.DocumentBuilderOnce you parse XML String to org.w3c.dom.Document you can use following classes and others for very effective XPath parsing.
javax.xml.xpath.XPathFactory
javax.xml.xpath.XPath
javax.xml.xpath.XPathExpression
javax.xml.xpath.XPathConstantsI have listed some classes which can help you to perform XPath parsing, you should also explore other classes in the API for more XML operations.
Refer thread: http://forums.sun.com/thread.jspa?threadID=5357836
Thanks,
Tejas Purohit -
Integrate java class with forms
dear friends,
i use forms9i under windows2000,
i try to implement a java class for a bean area.
i have some classes who oracle demo provide.
I DO the following :
save HTMLTextArea.class in <oracle_home>/forms90/java
and property palette of bean i write the class name in implementation class property HTMLTextArea
and also set the Forms60_Builder_Classpath varibale in registry(c:\ora9ids\forms90\java\HTMLTextArea so when i run this form then received an error
" java.lang.NoClassDefFoundError: HTMLTextArea (wrong name: oracle/forms/demos/HTMLTextArea).
plz solve this problem.I presume that you have to create the full path oracle/forms/demos/HTMLTextArea.class in the forms90/java folder...else,if you save there the java class without the full path (wich corespondds to the package oracle.forms.demos),the server won't find it..
However,this is bad practice,to keep the class file on the server...create a jar file with this class,and add it the archive_jini tag in formsweb.cfg file..place the jar file in forms90/java folder
Maybe you are looking for
-
How can I download my photos without icloud photo library
I have IOS8 and I did NOT turn on iCloud Photo library as I don't want to store my photos there. When I go to download them to my PC the files have an .AAE ext and I cannot open them.
-
JAAS LoginModule j_security_check and user info
Hello there, I successfully implemented custom LoginModule which validates users against passwords stored in database by calling some server api's. I am using container managed security via j_security_check servlet. This is working fine, now I just w
-
My ipod is stolen,, how can i disable it ?
pls help my it's a big problem to me
-
Configuration of Real time collaboration(IM)
Hi, I would like to configure my portal for Instant messaging between portal user. I mean if users are online then they can chat (Some what like Yahoo). I need help from scratch. How to go with it and what i need to configure for this. Its Urgent!!!.
-
Setting the load factor for a HashMap used to cache objects
I intend to use a HashMap to cache a small number of object and I am trying to initialize it such that it will execute lookups with minimal cost (time). I intend to initialize the HashMap with an initial capacity of 4, but I would appreciate any insi