This discussion is archived
2 Replies Latest reply: Mar 6, 2013 2:20 PM by baftos RSS

Asked to convert an application to Java

994043 Newbie
Currently Being Moderated
I have a small GUI tool written in another language that serves as a front end for Microsoft's SCCM 2007. The customer that I originally wrote this for has asked if it could be converted to Java (they are a Java shop), but I am struggling with the methodology of the language. I have some background in C++ and C#, so have a basic understanding of OO stuff, just seem to be faltering on syntax. Below is an example of connecting to the SCCM server and polling for a list of collections. I cannot figure out how to make a simple app in Java to do the same. Any suggestions would be greatly appreciated, even if the suggestion is "don't use Java for this".


$oLocator = ObjCreate("WbemScripting.SWbemLocator")
$objSMS = $oLocator.ConnectServer($SiteServer, "root\sms\site_" & $provSiteCode)
If @error Then MsgBox(0, "", "Can't Connect")
$objSMS.Security_.ImpersonationLevel = 3
$objSMS.Security_.AuthenticationLevel = 6

$sShell = ObjCreate("Wscript.Shell")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$SWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
$SWbemServices = $SWbemLocator.ConnectServer($SiteServer,"root\SMS\site_" & $provSiteCode)
$connection= $swbemServices

$oResults = $objSMS.ExecQuery("SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID = 'SMS00001'")
For $PC In $oResults
MsgBox(0, "", $PC)
Next
  • 1. Re: Asked to convert an application to Java
    gimbal2 Guru
    Currently Being Moderated
    JLogan3o13 wrote:
    I have a small GUI tool written in another language that serves as a front end for Microsoft's SCCM 2007. The customer that I originally wrote this for has asked if it could be converted to Java (they are a Java shop), but I am struggling with the methodology of the language.I have some background in C++ and C#, so have a basic understanding of OO stuff, just seem to be faltering on syntax.
    Why? C# and Java are incredibly similar; Java is even simpler with less 'flexibility' (Read: its a leaner language).
    I cannot figure out how to make a simple app in Java to do the same
    That's because you have about three months of studying and experimentation to do before you are that far. The language is only a tiny part of that three months.

    I'll be blunt: you should not be doing this; you don't have to required knowledge and experience. Someone who is qualified should do it.
  • 2. Re: Asked to convert an application to Java
    baftos Expert
    Currently Being Moderated
    As mentioned, syntax should not be a problem. But ObjCreate will certainly be. Looks like the program is too much Windows specific for Java to handle easily.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points