How to update the classpath on runtime
My Application enables the user to select a directory. After this all *.class files in the directory and the subdirectories are listed. The User can now select a class to be initialised.
This works well if the selected directory is in the Classpath. If the directory is not in the classpath, I tried to update the Classpath through
System.setProperty("java.class.path",classpath).
Well as I expected, this did not affect in any way. But how can I add the new directory to the classpath of the actual VM?
Can anybody help please?
Use a custom class loader. Examples have been posted in the forums. Search for them.
Similar Messages
-
How to update the ItemRenderer at runtime..?
Hi....
am facing a hectic problem with ITemRenderes..
My requirement is like i need to insert a Label and Image in
each item of Horizontal List.
For this i created a ArrayCollection with Lable and
ImagePath. And assigning array as a Dataprovider to HorizontalList.
and am attaching itemrenderer to it (which hold the lable and
image).
code:
var data:ArrayCollection=new ArrayCollection({label:'A',
path:'a.jpg'}, {label:'B', path:'b.jpg'}{label:'C', path:'c.jpg'});
var hList:HorizontalList=new HorizontalList();
hList.dataProvider=data;
hList.itemRenderer=new ClassFactory(rendererObj);
rendererObj holds the Lable Component and Image Componnet..
Now the porblem is am trying to change the horizontal list at
runtime. Like i want to change the lable of selected item in
Horizontal list. Am able to update the arraycollection values. But
its not getting effected in ItemRenderer.
How to update the itemerenderer at runtime...?
Thanks in Advance...
PratapHi Pratap,
I was playing with some sample code for this...
Here is the main.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.utils.ArrayUtil;
import mx.collections.ArrayCollection;
import mx.collections.IViewCursor;
import mx.controls.Alert;
import mx.events.*;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.controls.HorizontalList;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.containers.TitleWindow;
[Bindable] private var myItemRenderer:ClassFactory;
private function doit()
myItemRenderer = new ClassFactory(rendererObj);
var mydata:ArrayCollection=new
ArrayCollection([{mylabel:'A', path:'a.jpg'}, {mylabel:'B',
path:'b.jpg'},{mylabel:'C', path:'c.jpg'}]);
var myList:HorizontalList = new HorizontalList();
myList.dataProvider = mydata;
this.addChild(myList);
myList.itemRenderer=myItemRenderer;
]]>
</mx:Script>
<mx:Button x="204" y="191" label="Button"
click="doit()"/>
</mx:Application>
Here is the rendererObj.mxml (component/itemrenderer)
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="
http://www.adobe.com/2006/mxml"
width="110" height="76"
implements="mx.core.IFactory,mx.controls.listClasses.IDropInListItemRenderer"
backgroundColor="#BAB3B3" borderStyle="solid" borderThickness="3"
borderColor="#000000">
<mx:Script>
<![CDATA[
import mx.collections.IViewCursor;
import mx.controls.listClasses.BaseListData;
import mx.controls.Label;
private var _listData:BaseListData;
public function newInstance():*
return new rendererObj();
public function get listData() : BaseListData
return _listData;
public function set listData( value:BaseListData ) : void
_listData = value;
override public function set data(value:Object):void {
if (value != null)
var r:Label = new Label();
r.text = value.mylabel;
this.addChild(r);
]]>
</mx:Script>
</mx:VBox>
See how that works..you press the button and the itemrenderer
gets drawn into the horiz. list with the values from the
arraycollection.
I didnt implement the picture, but you get the idea on how to
get
the values into the hlist..
hope this helps... -
Updating the CLASSPATH at runtime
Is there a way for a Java program to update the CLASSPATH environment variable?
You really shouldn't write your own class loader, if you're using JVM 1.2+. URLClassLoader works great for this purpose, and I've used it often to dynamically load classes. (Check out the link supplied by a2135 above--it allows you truly to add classes to the classpath.)
Another problem you might be having is how you are resolving the classes you want to add. For instance, I've a class name Sort, in package com.pe_gmbh.util. This :
URLClassLoader loader = new URLClassLoader(new URL[] { new File("g:/_dev/OnlineApp/Kernel/classes/com/pe_gmbh/util/Sort.class").toURL() });
Class cl = loader.loadClass("com.pe_gmbh.util.Sort");throws a ClassNotFoundException. I rather have to include the base class path :
URLClassLoader loader = new URLClassLoader(new URL[] { new File("g:/_dev/OnlineApp/Kernel/classes/").toURL() });
Class cl = loader.loadClass("com.pe_gmbh.util.Sort");The dynamic class load would then have two steps--you would have the user enter the new classpath, and (after scanning it), choose the fully-resolved class to use.
Hope this helps,
Walter Gildersleeve
Productivity Engineering, GmbH
Freiburg, Germany -
How do I set the classpath in runtime?
How can i set the classpath in runtime?
Im downloading my image files in the folder C:/Downloads
I want to set this C:/Downloads as my classpath.
I don want to set it at the initial stage, bcoz I may have to change the downloading directory D:/Selva.
I want to access my */utils/New.gif* image available in the downloading directory by using getResource() method.java.net.URL urldir= new java.net.URL("file://C:/Downloads/");
java.net.URL[] urlarr= new java.net.URL[1];
urlarr[0]=urldir;
java.net.URLClassLoader urlcl= new java.net.URLClassLoader(urlarr); +// Here I get the Error+
url=urlcl.getResource("/lrp/utils/New.gif");
*Error: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader+ -
How to set the classpath in CVM?
Hi everybody,
experimenting with the J2ME Personal Profile Runtime Environment on a Linux PC I wonder how to set the classpath. The command line options only allow me to set the bootclasspath.
My original problems deals with determining the codebase for a class that is contained in a jar.
1) If I put this jar into the bootclasspath, that class is found and can be loaded, but the codebase (retrieved using class.getProtectionDomain().getCodeSource) is NULL.
2) If I put it into the classpath by using the command line option -Djava.class.path=... the class cannot be found by the ClassLoader.
3) If I put the jar into both, the classpath and the bootclasspath, the latter one is applied and result 1) shows up.
Any idea how to work around this?@see http://forum.java.sun.com/thread.jsp?forum=8&thread=410868
-
How to update the table value in the valuechange event?
I have an input field in the datatable with the valueChangeListener
<rich:dataTable id="cart" value="#{cart.cartList}" var="item">
<h:inputText value="#{item.cost}" id="qty" valueChangeListener="#{items.updateCost}" onchange="submit()">
<h:outputText value="#{item.errorMsg}"> </h:outputText>
in the backing bean
Item item = (Item) model.getRowData();
// do some update, if the cost too larger, change to max_cost
item.setCost(max_cost);
item.setErrorMsg("Error Msg");
After calling the valuechange method, the screen output doesn't update the cost.
How to update the table value in the valuechange event?As you're misusing the valueChangeListener to set another input field, you need to skip the update model values phase. Otherwise the value set in the valueChangeListener will be overridden by the submitted value. You can do this by calling the FacesContext#renderResponse() inside the valueChangeListener method. This will shift the current phase immediately to the render response phase, hereby skipping the update model values and invoke application phases.
-
How to update the condition price in the sales order for all the items
Hi,
How to update the condition price for all the itmes in the sales order to carry out the new price automatically through a stand alone program, for all the orders in the billing due list table?
Thanks,
BalaramHi,
There is a change in the requirement.
Scenario:
I have created a sales order with some 4 condition types, in that 2 condition types are of class A & B and the other two is of class C. Here I need to update the condition price of class A & B only and the remaining condition types should not get update even though there is an updated price is available.
For the above scenario, I need to write a standalone program. Do we have any function modules to update the price of the single condition in the sales order? Please tell me how we can update the sales order at item condition level.
Thanks.
Balaram -
How to update the condition price in sales order while creating the invoice
Hi,
How to update the condition price in the sales order to carry out the new price while creating the invoice?
While creating the invoice it should update the condition price in sales order.
Thanks,
BalaramNo, pricing is not there in delivery.
I found an exit for VF01transaction where we can update the price in order.
Can you please tell me how to update the price if I have the order, material numbers and conditions number?
Thanks,
Balaram -
How to update the inventory after committing order..?
How to update the Inventory stock level of a commerce item after committing the order.. in ATG 10.0.1..?
Thanks in Advance,
Vishnu & Nithin Kayithiyou can add the pipeline chain after the processOrder in the commerce pipeline , in the runProcess method call InventoryManager.decreaseStockLevel(String pId, long pNumber);
-
How to update the data in sqlserver table using procedure in biztalkserver
Hi,
Please can any one answer this below question
how to update the data in sqlserver table using procedure in biztalkserver
while am using executescalar,typedprocedure getting some warning
Warning:The adapter failed to transmit message going to send port "SendtoSql1" with URL "mssql://nal126//MU_Stage2?". It will be retransmitted after the retry interval specified for this Send Port. Details
Please send me asap....
Thanks...Hi Messip,
A detailed error would have helped us to answer you more appropriately but
You can follow the post which has step by step instructions, to understand how to use Stored Procedure:
http://tech-findings.blogspot.in/2013/07/insert-records-in-sql-server-using-wcf.html
Maheshkumar
S Tiwari|User
Page|Blog|BizTalk
2013: Inserting RawXML (Whole Incoming XML Message) in SQL database -
How to update the BOX version of the Logic Pro 9 in Mountain Lion??
Hi!
How to update the BOX version of the Logic Pro 9 in Mountain Lion?
For example, if tomorrow will be new updates for Logic Pro for exapmle 9.1.8. (now I have 9.1.7) Will I not able to get it?? Now should I buy the second Logic pro??
Recently I have got answer from App Store support:
"Max, since you have not purchased the app in the App Store, you can't get updates directly in App Store. In this case, you will need to purchase the updated version in the App Store so you can get further updates."
It's... I bought Logic Pro 9 + MainStage + + +++ .... in the Apple Retail Store and what now?? Updates works perfect in Snow Leopard.
I can't understand...
Can you help me please? =)Max,
Rest assurred, you will get updates via the App store. What will happen is when you install the box version, the Mac App Store will ping when there is an update to download(for free), much like any other Apple app(Garageband, iWork, etc) regardless of where you bought it from. If it's installed, it will check for updates.
If the Mac App store doesn't show an update that you know is out, simply down it directly from support.apple.com and apply it.
Hope this helps. If so, LIKE the post.
Glenn -
How to update the FB01L transaction using the FM bapi_acc_document_post
Hi All,
How to update the FB01L transaction using the bapi_acc_document_post but there is no ledger group field in the bapi function module.
Please help me how to do it.hi,
use batch input method for the same.
check this.
[https://forums.sdn.sap.com/click.jspa?searchID=19107237&messageID=884744] -
How to set the CLASSPATH in Unix Server
Hi, everyone~
Do anyone noe how to set the CLASSPATH in the hp-ux server? I tried the setenv CLASSPATH, but not working.. I think should use export. But my jsp pages still cannot working, dunnoe y?
I wonder is the hp-ux support jsp and servlet or not?
In order to let the jsp and servlet to run properly in the unix server, what kinds of steps should taken ?
Hope somemore who experience with this situation b4 can give me some guidance.. Thanks~~
regards,
tzeyikTomcat ignores any and all CLASSPATH environment variables. Even if you could figure out how to set it, Tomcat wouldn't use it.
Better to learn how Tomcat's CLASSPATH works and how to deploy Web apps properly. - MOD -
How to update the iTunes in the iPad using the I pad
How to update the iTunes in the iPad using the I pad?
Then you cannot update without Conecting to iTunes on a computer.
The Over the Air Feature is only available on iOS 5 or later.
You have iOS 4... See Here...
http://support.apple.com/kb/HT4972
OR...
Connect to iTunes on the computer you usually Sync with and “ Check for Updates “...
See the Using iTunes Section Here...
How to update your iPhone, iPad, or iPod touch -
How to change the classpath in rmiregistry
I am storing remote object stubs in an RMI registry as part of my application. When I try to bind my objects to the rmiregistry started by the kxs process on port 1099, I get class def not found errors because that rmiregistry does not have my classes in the classpath. My classes are in the iAS classpath because I added them through the registry.
When I start my own rmiregistry on a different port and set the classpath environment variable to include my classes, then I have no problems.
Does anyone know how to change the classpath for the rmiregistry started by the kxs process?
I am running iAS sp3 on Windows 2000 adn Solaris
Thanks,
MarkHi,
I would like to help, but could you kindly clarify what rmiregistry
means ?
Regards
Raj
Mark Priest wrote:
I am storing remote object stubs in an RMI registry as part of my
application. When I try to bind my objects to the rmiregistry started
by the kxs process on port 1099, I get class def not found errors
because that rmiregistry does not have my classes in the classpath.
My classes are in the iAS classpath because I added them through the
registry.
When I start my own rmiregistry on a different port and set the
classpath environment variable to include my classes, then I have no
problems.
Does anyone know how to change the classpath for the rmiregistry
started by the kxs process?
I am running iAS sp3 on Windows 2000 adn Solaris
Thanks,
Mark
Try our New Web Based Forum at http://softwareforum.sun.com
Includes Access to our Product Knowledge Base!
Maybe you are looking for
-
Hi, I have a requirement to put the Sales Commission Lines (Oracle Incentive Compensation module) on hold for a particular Salesperson if the corresponding invoice line has an amount due not equal to zero. Now to put the commission lines on hold I ne
-
Error when Connecting to Remote Host
Hi, I am not sure if this post belongs here or in the network section, if I need to repost this in the networks section please let me know! The problem is when I use an applet to connect to a remote host I get an error.I am am pasting the error below
-
AMD Dual Core Processor - Problem between tracks
I am running iTunes on a dual core AMD Athlon processor and notice strange behavior on the computer. When iTunes moves from one track to the next, it sounds like it is playing the end of the first track at the same time as the beginning of the second
-
Posseggo Adobe acrobat 7 professional, dopo l'aggiornamento a Windows 8.1 al tentativo di avvio esce pop up con errore: (0xc00000fd) come risolvere?
-
Trouble in dynamic method invocation
hai forum, Your previous responses on this topic 'method invocation' has greatly helped me in writing a code to invoke method dynamically.As some experts pointed out,the parameters had to be type casted. Please help me out of my latest trouble.I invo