cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

JLink Techniques to Determine Platform (32 vs. 64-bit)

mark_stallard
1-Newbie

JLink Techniques to Determine Platform (32 vs. 64-bit)

Hi Everyone -

I have a JLink application which relies a Pro/Toolkit task DLL - JLink
doesn't support drawing format symbol groups on Wildfire 3. I can use
the same Java code on both 32-bit and 64-bit Windows, but I need different
versions of the DLL for each.

Is there a way a JLink program can determine at run-time which platform
Pro/E is running on? If my program knows it's running in a 64-bit env-
ironment, then it can load the 64-bit DLL instead of the 32-bit.

If there isn't a specific JLink method, can anyone suggest a config.pro
option or environment variable that is unique to either platform?

|+| M a r k |+|

Mark Stallard
Engineering Information Management
Integrated Solutions & Development
Integrated Defense Systems
Raytheon Company



(business)
+1.978.436.6016
(cell)
+1.617.331.5443
(tie line)
239.6016
-

880 Technology Drive
Billerica, MA 01821
www.raytheon.com


This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive mail for the
addressee), you should not use, copy or disclose to anyone this message or
any information contained in this message. If you have received this
message in error, please so advise the sender by reply e-mail and delete
this message. Thank you for your cooperation.



This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
5 REPLIES 5

Wow, I think this will be my "first" J-Link related response on this forum.

Mark,
I don't believe there are any J-Link specific methods to determine if the architecture of Pro/ENGINEER (32 vs 64). However; Java has some functions to retrieve OS architecture information. If Raytheon has a standard of loading 64 bit Pro/ENGINEER on 64 bit Windows then you can make the assumption based upon the OS. Try the following.

public class OpertingSystemInfo
{
public static void main(String[] args)
{
String nameOS = "os.name";
String versionOS = "os.version";
String architectureOS = "os.arch";
System.out.println("\n The information about OS<");">http://www.roseindia.net/java/beginners/OSInformation.shtml>");
System.out.println("\nName of the OS: " +
System.getProperty(nameOS));
System.out.println("Version of the OS: " +
System.getProperty(versionOS));
System.out.println("Architecture of THe OS: " +
System.getProperty(architectureOS));
}
}

Patrick Williams | Engineering Systems | Sr. Applications Engineer | Steelcase Inc. | 616.698.4078

[cid:image001.jpg@01CA5C5A.DBAA8D00]

Hi Mark,



You can probably just check the environment variable PRO_MACHINE_TYPE.
It's set when Pro/E starts and it will either be:



i486_nt or x86e_win64 based on which architecture of Pro/E you run.



You don't want to check the OS architecture because you can run the 32
bit version of Pro/E on 64 bit so that would break your logic.



We do this in our protk.dat and have both 32 bit and 64 bit DLL's
available. It will start the correct architecture based on Pro/e.



This is an example from our Protk.dat



exec_file c:\dev\toolkit\$PRO_MACHINE_TYPE\Toolkit.dll



I then have 2 folders. One called i486_nt with the 32 bit version of the
DLL and the other called x86e_win64 with the 64 bit version.



Example folder structure:



C:\dev\MyToolkitApp\protk.dat

C:\dev\MyToolkitApp\i486_nt\MyToolkitApp.dll

C:\dev\MyToolkitApp\x86e_win64\MyToolkitApp.dll



Doing it this way means you share the menu files, text files etc. but
just segregate the DLL to be specific to the architecture.



This works well with Pro/TOOLKIT so I'm guessing the same logic can
apply to J-Link.



Thanks,

Bryan






Bryan,
That is a perfect way to do this. Thanks for the technique.

Patrick Williams | Engineering Systems | Sr. Applications Engineer | Steelcase Inc. | 616.698.4078

[cid:image002.jpg@01CA5C6B.21980F30]

All,

I was following this discussion and saw the solution of checking the environment variable PRO_MACHINE_TYPE, which definitelylooks like the best place to get it from. But my question to the group is - from JLink, what's the best way of getting an OS environment variable?

The System.getProperty() method only gets JVM system properties.The only way I could think of was to set the config.pro option for the JLINK_JAVA_COMMAND with a "-Dpro_machine_type=%PROE_MACHINE_TYPE%" option to pass the value (if that would even work). Is there a better way?

thanks,

Gary Hoffman

Solar Turbines Inc

Check out this link. Google search "get environment variables in java".

Top Tags