Archive: Java Class with $ causes error


Java Class with $ causes error
I have a java class that has a dollar sign in the name when is compiled.

Anyone have any ideas how to make the following work?

File "MyApp\LibMessageDigester$MyHandler.class"

Wanted to try to escape it with \ but that will be considered part of the path?

File "MyApp\LibMessageDigester\$MyHandler.class"


Any pointers greatly appreciated.

Jay Smith
jay.w.smith@tyson.com


Use $$.


Thanks for the quick reply but that did not work, did I do it wrong?

File: MyApp\LibMessageDigester$$MyHandler.class" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] filespec [...]|/oname=outfile one_file_only)
Error in script "C:\Temp\NSIS SCRIPTS\SST.nsi" on line 59 -- aborting creation process


Hmm... Thinking about it again, it shouldn't even process the dollar sign, so there is no reason to escape it. I have just tested it and it works fine. Make sure you got the path right.


I forgot that the orginal files get deleted, the installer piece works ok, complains of an undefined variable in the uninstall section with the DELETE "my$StupidFile.class" but the installer does build.

It doesn't remove that file during uninstall. Thanks for you help I really appreciate you taking the time.

Jay


In the Delete line you need double dollar sign because it is parsed.


Tried that and it does not complain about the undefined variable but still doesn't remove the file at uninstall time.

Thanks, I will just but it in the known issues list and roll on. Maybe there will be a solution for it in the future.

Thanks again.


You should specify a full path when using delete. Use:

Delete $INSTDIR\my$$StupidFile.class

This is the actual line I am using
Delete "C:\Program Files\cognos\crn\sdk\java\ExecReportsInstall\ExecReportsUI$$MenuHandler.class"


Try verifying the path and make sure it's not in use.


And man are you fast at reading these post. I have neve seen responses this fast.

Ok, that did work changed it from C:\Program Files\cognos\crn\sdk\java\ExecReportsInstall to $INSTDIR and it started working. Dummy me, I wasn't pointed to the install dir at all.

Thanks so much for humor a stupid programmer, today I am worn out. It's working and you were a great help.

Jay


Hi, I've got a question related to this long dead thread's discussion:

I'm making an installer which will contain Java-files containing $-signs in the filename. I'm also using the
Uninstall log. The specific macro I'm having some problems with is.

; File macro
!macro File FilePath FileName
IfFileExists "$OUTDIR\${FileName}" +2
FileWrite $UninstLog "$OUTDIR\${FileName}$\r$\n"
File "${FilePath}${FileName}"
!macroend
!define File "!insertmacro File"


When I add files using e.g

${File} "c:\Muppet$Kermit.txt"


it generates warnings since both the IfFileExists and FileWrite are runtime and will think $Kermit.txt is a variable and can't find it.

I'm using a external script which generates these lines in an autobuild enviroment so there would not be any problem generating

${File} "c:\Muppet$$Kermit.txt"


instead, but this results in an "file not found" error.



Is there anyway to make IfFileExists and File behave the same regarding variable names?

Or

Is there another uninstall log which is recommended for use? (since these macros doesn't seem to have changed for a couple of years)

Or do I have to rewrite these macros to change the string for the IfFileExists command? (uglyfying the code)

I think the easiest solution in this case would be uglyfying the code.