This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Bringing in files
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 28, 2008
01:47 PM
Bringing in files
I have a custom code panel that needs to display different text depending upon the platform the installer is run on.
I pull this text from a file.
Everything works fine if I hard code the path and the file exist.
But when it is installed, the customcodepanel doesn't know where to find the file as nothing has been installed on the machine yet.
I tried including the files in the jar file, but I don't know how to access the jar file during the install.
How have others got around this problem?
Remember my java is not the strongest so type slow. 😉
Bill
I pull this text from a file.
Everything works fine if I hard code the path and the file exist.
But when it is installed, the customcodepanel doesn't know where to find the file as nothing has been installed on the machine yet.
I tried including the files in the jar file, but I don't know how to access the jar file during the install.
How have others got around this problem?
Remember my java is not the strongest so type slow. 😉
Bill
(7) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 28, 2008
03:46 PM
Looks like I might be able to use
customCodePanelProxy.getResource
Bill
customCodePanelProxy.getResource
Bill
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 29, 2008
03:13 PM
That doesn't seem to be working. Keeping getting NullPointerException. so if anyone has any ideas, let me know.
Bill
Bill
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 01, 2008
04:27 AM
Would you mind posting the entire exception you get?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 03, 2008
10:23 AM
Away from work on the weekend:
public class DisplayImage extends CustomCodePanel implements ActionListener,ItemListener {
.
.
.
.
public boolean setupUI( CustomCodePanelProxy ccpp ) {
if(!inited) {
//
// set the flag to true.
//
inited = true;
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
this.setLayout( gridbag);
TextArea txtAreaLic = new TextArea();
FileReader fr = null;
try {
URL myurl = ccpp.getResource("EULA.win");
}
catch (MalformedURLException e) {
System.err.println(e);
}
licFile = new File(myurl.getFile());
The licFile is the line where the execption occurs.
I have also tried using CustomCodePanelProxy.getResource("EULA.win")
EULA.win is in the top level of the jar file.
Now for the exception:
System's temporary directory = C:\Documents and Settings\Administrator\Local Settings\Temp
Loading externalized properties
Error running install panel: License Agreement
java.lang.NullPointerException
java.lang.NullPointerException
at com.zerog.ia.customcode.installpanels.DisplayImage.setupUI(DisplayImage.java:156)
at com.zerog.ia.installer.AAMgr.a(DashoA10*..)
at com.zerog.ia.installer.AAMgr.a(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.e(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.m(DashoA10*..)
at com.zerog.ia.installer.AAMgr.a(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.e(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.m(DashoA10*..)
at com.zerog.ia.installer.AAMgr.g(DashoA10*..)
at com.zerog.ia.installer.AAMgr.actionPerformed(DashoA10*..)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Line 156 is the licFile line.
public class DisplayImage extends CustomCodePanel implements ActionListener,ItemListener {
.
.
.
.
public boolean setupUI( CustomCodePanelProxy ccpp ) {
if(!inited) {
//
// set the flag to true.
//
inited = true;
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
this.setLayout( gridbag);
TextArea txtAreaLic = new TextArea();
FileReader fr = null;
try {
URL myurl = ccpp.getResource("EULA.win");
}
catch (MalformedURLException e) {
System.err.println(e);
}
licFile = new File(myurl.getFile());
The licFile is the line where the execption occurs.
I have also tried using CustomCodePanelProxy.getResource("EULA.win")
EULA.win is in the top level of the jar file.
Now for the exception:
System's temporary directory = C:\Documents and Settings\Administrator\Local Settings\Temp
Loading externalized properties
Error running install panel: License Agreement
java.lang.NullPointerException
java.lang.NullPointerException
at com.zerog.ia.customcode.installpanels.DisplayImage.setupUI(DisplayImage.java:156)
at com.zerog.ia.installer.AAMgr.a(DashoA10*..)
at com.zerog.ia.installer.AAMgr.a(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.e(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.m(DashoA10*..)
at com.zerog.ia.installer.AAMgr.a(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.e(DashoA10*..)
at com.zerog.ia.installer.AAMgrBase.m(DashoA10*..)
at com.zerog.ia.installer.AAMgr.g(DashoA10*..)
at com.zerog.ia.installer.AAMgr.actionPerformed(DashoA10*..)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Line 156 is the licFile line.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 03, 2008
10:32 AM
Well the problem seem to be with the access to the EULA file right? Shouldn't that be a full path to the file?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 03, 2008
11:33 AM
A word about the getResource(String archivePath) method. Make sure the resource is in the installer, not the same jar file as the custom panel. A suggestion may be is to add it to the DO_NOT_INSTALL folder in the Install step. Then use that path to the file in your source code.
What you can also do is to package up the lic file in the same jar file as your custom panel, but then you have to use the getClass().getResource(String) or getClass().getResourceAsStream(String) method and maybe have to add a leading / to the string.
What you can also do is to package up the lic file in the same jar file as your custom panel, but then you have to use the getClass().getResource(String) or getClass().getResourceAsStream(String) method and maybe have to add a leading / to the string.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 03, 2008
12:05 PM
I am using this file in the pre-install step.
I can't put a full path because the files are not installed on the system.
About the DO_NOT_INSTALL idea, in IA do I have access to these files in the pre-install phase? If so how? getVariable()?
"What you can also do is to package up the lic file in the same jar file as your custom panel, but then you have to use the getClass().getResource(String) or getClass().getResourceAsStream(String) method and maybe have to add a leading / to the string."
Will try this out also.
I can't put a full path because the files are not installed on the system.
About the DO_NOT_INSTALL idea, in IA do I have access to these files in the pre-install phase? If so how? getVariable()?
"What you can also do is to package up the lic file in the same jar file as your custom panel, but then you have to use the getClass().getResource(String) or getClass().getResourceAsStream(String) method and maybe have to add a leading / to the string."
Will try this out also.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)