Solved

Best way to go about Win32 calls for Disk Mangament in a Java application (Similar to Rescan Disk in MyComputer->Manage->disk Management->Rescan Disks)

Posted on 2004-09-21
17
441 Views
Last Modified: 2013-12-03
I'm totally new to Windows API calls, but I need to create a Java Application that is similar to the Rescan Disk operation in Windows, MyComputer->Manage, right click Disk Managment->Rescan Disks. So basically I need to write a Java Application that will pick up on newly Mapped and Masked storage without having to shutdown the Host PC. I was wondering could anyone tell me the best way to approach to this by answering the below questions:

1) How do I call Win32 calls within my Java Application?
2) What type of Win32 calls do I have to use?
0
Comment
Question by:Dcom4CIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 3
  • +3
17 Comments
 
LVL 35

Assisted Solution

by:girionis
girionis earned 50 total points
ID: 12110949
You will have to use JNI: http://java.sun.com/docs/books/tutorial/native1.1/

Otherwise, if you already know the application that does it call it by using the Runtime class:

Runtime.getRuntime().exec("<application that rescans the disk">);
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12110965
Why would you want to write this in Java?
0
 

Author Comment

by:Dcom4CIT
ID: 12111567
Well I don't HAVE to do it in Java, but I'm more comfortable with Java. What language would you recommend? and why?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 12111581
Java has no natural interface with the OS. You would be better with a platform-specific language - VBA, Visual C++?
0
 

Author Comment

by:Dcom4CIT
ID: 12111687
I'm doing a project for my final year in College, its an Automated Storage Provisioning project. Basically when a host is deemed to require extra storage the application will configure and dynamically add EMC Symmetrix Storage to the Host in question. The Project is using EMC storage API, the version of the EMC Storage API I'm hoping to use is a Java version. After the application Maps, Masks (this will be done with EMC API) etc.. it should rescan the disks to pick up on the new storage(This will be Win32 calls).

At the moment i'm doing research to find the best way to go about it, so any ideas are greatly appreciated.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12111871
>>the version of the EMC Storage API I'm hoping to use is a Java version

Well i don't know this, but if it uses native code as well, that could be an argument for integrating your own native code into it with JNI
0
 

Author Comment

by:Dcom4CIT
ID: 12111984
So your saying I should program the application in Java and use the Win32 calls using the JNI?
0
 
LVL 15

Assisted Solution

by:Javatm
Javatm earned 50 total points
ID: 12113451
> So your saying I should program the application in Java and use the Win32 calls using the JNI?

Use Java as an interface, JNI as the bridge and other language (C, C++) for Specific OS task.

Hope that helps . . .
Javatm
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 200 total points
ID: 12114223
>>So your saying I should program the application in Java and use the Win32 calls using the JNI?

There are various ways you could approach this. e.g. if you have an API written in Java, to which you need to add some system functionality, depending on the proportions involved, you could supply a unified Java Facade to the various other parts of the system. e.g.

public class FileManagement {
      
      ......
      
      public void foo() {
            // Call existing api
            emc.foo();
            
      }
      
      // Call one of your JNI methods
      public int native rescanDisks();
      
      ......
      
      
}
0
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 12118045
0
 
LVL 9

Expert Comment

by:doronb
ID: 12118886
Why not do it in C# where the syntax is Java-like and the whole Windows API is at your disposal?
0
 

Author Comment

by:Dcom4CIT
ID: 12131295
Does anyone know what Win32 calls I would need for this project?
0
 
LVL 92

Expert Comment

by:objects
ID: 12131308
best bet would be to ask in the windows programming ta.
0
 

Author Comment

by:Dcom4CIT
ID: 12131638
Ok Thanks
0
 
LVL 35

Expert Comment

by:girionis
ID: 12131780
:)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12131791
8-)
0
 
LVL 92

Expert Comment

by:objects
ID: 12138599
good luck with it, let me know if you need further assistance :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet example 17 59
how to debug htl and js pages 8 53
jsp CRUD operations with and without prepared statement also hibernatge 1 27
passing enum to a method 4 34
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question